Created
March 26, 2013 18:39
-
-
Save TiernanKennedy/5247962 to your computer and use it in GitHub Desktop.
New Obj C Syntax
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
// Updates to LLVM give us better instantiation methods | |
NSNumber *n1 = @1000; // [NSNumber numberWithInt:1000] | |
NSNumber *n2 = @3.1415926; // [NSNumber numberWithDouble:3.1415926] | |
NSNumber *c = @'c'; // [NSNumber numberWithChar:'c'] | |
NSNumber *b = @YES; // [NSNumber numberWithBool:YES] | |
Arrays | |
// before | |
NSArray *words = [NSArray arrayWithObjects:@"list", @"of", @"words", nil]; | |
// after (array with some strings and numbers) | |
NSArray *words = @[@"list", @"of", @"words", @123, @3.14]; | |
Dictionaries | |
NSDictionary *d = @{ | |
@"key": @"value", | |
@"name": @"Joris", | |
@"n": @1234, | |
@3: @"string" | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment