Skip to content

Instantly share code, notes, and snippets.

@squm
Created November 29, 2013 12:02
Show Gist options
  • Save squm/7704751 to your computer and use it in GitHub Desktop.
Save squm/7704751 to your computer and use it in GitHub Desktop.
How safe is @1 as dictionary key. NSInteger, NSUInteger int32_t will always map to the same key?
typedef NS_ENUM(int32_t, CFG) {
CFG10,
CFG20,
CFG30
};
NSDictionary *const cfgToString = @{
@(CFG10) : @"CFG10",
@(CFG20) : @"CFG20",
@(CFG30) : @"CFG30"
};
NSDictionary *const cfgFromString = @{
@"CFG10" : @(CFG10),
@"CFG20" : @(CFG20),
@"CFG30" : @(CFG30)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment