Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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