Created
December 21, 2015 02:58
-
-
Save Pretz/e7b986ccefff8b83b379 to your computer and use it in GitHub Desktop.
Example of using `===` to compare Types in Swift
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 Obj {} | |
class Obj2: Obj {} | |
let item1 = Obj(), item2 = Obj2() | |
if item1.dynamicType === item2.dynamicType { | |
print("Same subclass") | |
} else { | |
print("Different subclass") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment