Skip to content

Instantly share code, notes, and snippets.

@danie7k
Last active February 9, 2017 09:16
Show Gist options
  • Save danie7k/927120fc6b754c4a2b5d436ae86e67ac to your computer and use it in GitHub Desktop.
Save danie7k/927120fc6b754c4a2b5d436ae86e67ac to your computer and use it in GitHub Desktop.
iOS Objective-C switch with string
NSString *testedString;
__block NSString *selected;
((void (^)())@{
@"A" : ^{
selected = @"A selected";
},
@"B" : ^{
selected = @"B selected";
},
@"C" : ^{
selected = @"C selected";
},
}[testedString] ?: ^{
// default
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment