-
-
Save damianesteban/3df857b88780a27afb0f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func passAnyObject(param: AnyObject) { | |
print(param) | |
} | |
class MyClass {} | |
struct MyStruct {} | |
let a: Int = 1 | |
let b = 2.0 | |
let c = NSObject() | |
let d = MyClass() | |
let e = MyStruct() | |
passAnyObject(a) | |
passAnyObject(b) | |
passAnyObject(c) | |
passAnyObject(d) | |
//passAnyObject(e) // Argument type 'MyStruct' does not conform to expected type 'AnyObject' | |
if a is AnyObject { | |
print("\(a.dynamicType) is AnyObject") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment