Objective-C literals
Very useful stuff.
Numbers
NSNumber *myInt = @1337;
NSNumber *myFloat = @13.37;
Arrays
NSArray *array = @[ @"first", @"second", @"third" ];
NSString *object = array[0]; // first
Dictionaries
NSDictionary *dictionary = @{ @"firstKey": @"firstValue", @"secondKey" : @"secondValue", @"thirdKey" : @"thirdValue" };
NSString *value = dictionary[@"firstKey"]; // firstValue
Written by Jure Žove
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Objective-c
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#