Skip to content

Instantly share code, notes, and snippets.

@ffried
Last active July 27, 2016 15:14
Show Gist options
  • Save ffried/787e71fd284a800246f72e6d6e2bb0fe to your computer and use it in GitHub Desktop.
Save ffried/787e71fd284a800246f72e6d6e2bb0fe to your computer and use it in GitHub Desktop.
NS_OPTIONS-Swift
//ObjC
typedef NS_OPTIONS(NSUInteger, SomeOptions) {
SomeOptionsStarted,
SomeOptionsWorking,
SomeOptionsFailed,
SomeOptionsFinished
};
// Swift
// Generated:
public struct SomeOptions : OptionSetType {
public init(rawValue: UInt)
public static var Started: SomeOptions { get }
public static var Working: SomeOptions { get }
public static var Failed: SomeOptions { get }
public static var Finished: SomeOptions { get }
}
// RawValues:
SomeOptions.Started.rawValue == 0
SomeOptions.Working.rawValue == 1
SomeOptions.Failed.rawValue == 2
SomeOptions.Finished.rawValue == 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment