Created
June 24, 2014 20:37
-
-
Save uberto/ec9af96637c1910718d2 to your computer and use it in GitHub Desktop.
Magic dynamicity in Swift for legacy objects
This file contains 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
class Foo: NSObject{ func foo() -> String{return "foo"}} | |
class Bar {func bar() -> String{return "bar"}} | |
let b: AnyObject = Bar() | |
//fail b.bar() | |
let f: AnyObject = Foo() | |
f.foo() //it works! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment