Objective-C literals for NSDictionary, NSArray, and NSNumber
Objective-C literals: one can now create literals for NSArray, NSDictionary, and NSNumber (just like one can create literals for NSString)
NSArray Literals
Previously:
array = [NSArray arrayWithObjects:a, b, c, nil];
Now:
array = @[ a, b, c ];
NSDictionary Literals
Previously:
dict = [NSDictionary dictionaryWithObjects:@[o1, o2, o3]
forKeys:@[k1, k2, k3]];
Now:
dict = @{ k1 : o1, k2 : o2, k3 : o3 };
NSNumber Literals
Previously:
NSNumber *number; number = [NSNumber numberWithChar:'X']; number = [NSNumber numberWithInt:12345]; number = [NSNumber numberWithUnsignedLong:12345ul]; number = [NSNumber numberWithLongLong:12345ll]; number = [NSNumber numberWithFloat:123.45f]; number = [NSNumber numberWithDouble:123.45]; number = [NSNumber numberWithBool:YES];
Now:
NSNumber *number; number = @'X'; number = @12345; number = @12345ul; number = @12345ll; number = @123.45f; number = @123.45; number = @YES;
![]()
110 Notes/ Hide
-
oneweekgame reblogged this from cocoaheads
-
fcedillo likes this
-
ricardofalasca reblogged this from cocoaheads
-
iosadam reblogged this from cocoaheads
-
mrakowski likes this
-
amirmemon reblogged this from cocoaheads
-
musiccodewine reblogged this from cocoaheads and added:
A little while ago, I said I was going to take a wait and see approach with these literals. Well, with a new project...
-
jeffcarp likes this
-
artbgz reblogged this from cocoaheads and added:
I don’t know how I can live without this (|l|O_o)
-
artbgz likes this
-
alexvinidiktov reblogged this from cocoaheads
-
shiftingboundaries likes this
-
myhandmadejewelry likes this
-
fiftymill likes this
-
stelabouras likes this
-
marashliev likes this
-
avenjamin likes this
-
ania-springer reblogged this from cocoaheads
-
mackmac reblogged this from cocoaheads
-
halsk reblogged this from cocoaheads
-
jdrama418 reblogged this from cocoaheads
-
setimouse likes this
-
wonwon-pierce reblogged this from cocoaheads
-
smokyonion reblogged this from cocoaheads
-
algorizms likes this
-
largemunchkin likes this
-
joshtimonen reblogged this from cocoaheads and added:
Apparently this is COMING SOON.
-
gr4y likes this
-
ellduin likes this
-
jasonsjams likes this
-
yulianii likes this
-
kennygunie reblogged this from cocoaheads
-
kennygunie likes this
-
amirsaam reblogged this from cocoaheads
-
jimmyhansen likes this
-
inamiy likes this
-
ldrer likes this
-
shinyzhu likes this
-
sumitpaul likes this
-
seapomeranian reblogged this from cocoaheads
-
neoroman likes this
-
1thingtoday likes this
-
hengsu likes this
-
xeokeri likes this
-
guixing reblogged this from cocoaheads
-
asmallteapot reblogged this from cocoaheads and added:
So excited.
-
asmallteapot likes this
-
writtenmontage likes this
-
iamitv reblogged this from cocoaheads
-
slowfocus reblogged this from cocoaheads
- Show more notes
