Vote count:
0
Reading the Type Casting section of the Swift Guide I see I use the is keyword to type check variables.
func isString(test: AnyObject?) -> Bool {
return test is String
}
It seems when I try something similar to check for a Tuple containing three NSNumber objects, I receive a 'Tuple does not conform to protocol AnyObject'. Is there any way to check if a variable contains a Tuple?
func isTuple(test: AnyObject?) -> {
return test is (NSNumber, NSNumber, NSNumber) // error
}
asked 35 secs ago
How do I check if a var is a Tuple in Swift?
Aucun commentaire:
Enregistrer un commentaire