Skip to content

Instantly share code, notes, and snippets.

@Pretz
Created December 21, 2015 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pretz/e7b986ccefff8b83b379 to your computer and use it in GitHub Desktop.
Save Pretz/e7b986ccefff8b83b379 to your computer and use it in GitHub Desktop.
Example of using `===` to compare Types in Swift
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