Reputation: 51951
Xcode does not give an error of my (thought-to-be) typo:
NSString *theme = [[NSUserDefaults standardUserDefaults] objectForKey:@"theme"];
NSLog(@"Theme: %@", theme ?: @"Default");
It turns out:
NSLog(@"Theme: %@", theme ?: @"Default");
works same as:
NSLog(@"Theme: %@", theme ? theme : @"Default");
Is the above shorten syntax good for gcc only? Or it is part of Objective-C?
Upvotes: 25
Views: 3207