Created
November 3, 2014 21:05
-
-
Save natecook1000/9e32a5067038791f3dab to your computer and use it in GitHub Desktop.
Using ObjC-defined NS_OPTIONS in Swift
This file contains hidden or 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
| // objective-c: | |
| typedef NS_OPTIONS(NSInteger, MesozoicPeriod) { | |
| MesozoicPeriodTriassic, | |
| MesozoicPeriodJurassic, | |
| MesozoicPeriodCretaceous | |
| }; | |
| // Swift | |
| let period: MesozoicPeriod = MesozoicPeriod.Jurassic | |
| let period2 = MesozoicPeriod.Jurassic | MesozoicPeriod.Cretaceous | |
| if (period2 & MesozoicPeriod.Jurassic != nil) { | |
| println("Jurassic") | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment