Last active
February 9, 2017 09:16
-
-
Save danie7k/927120fc6b754c4a2b5d436ae86e67ac to your computer and use it in GitHub Desktop.
iOS Objective-C switch with string
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
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