Last active
March 15, 2016 15:32
-
-
Save jsorge/e5237717ecf1b18cab66 to your computer and use it in GitHub Desktop.
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
import UIKit | |
protocol ResponderTest: class { | |
var name: String { get } | |
func printName() -> String | |
} | |
extension ResponderTest where Self: NSObject { | |
func printName() -> String { | |
return name | |
} | |
} | |
class ResponderObject: NSObject, ResponderTest { | |
let name = "Jared" | |
} | |
let testObject = ResponderObject() | |
print(testObject.printName()) | |
let sel = Selector("printName") | |
let responds = testObject.respondsToSelector(sel) | |
if responds { | |
print("It works! 🎉") | |
} | |
else { | |
print("It doesn't 💀🔥") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment