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;
![]()
86 Notes/ Hide
-
wonwon-pierce reblogged this from cocoaheads
-
de-realestate reblogged this from cocoaheads
-
smokyonion reblogged this from cocoaheads
-
rizwansattar liked this
-
largemunchkin liked this
-
joshtimonen reblogged this from cocoaheads and added:
Apparently this is COMING SOON.
-
gr4y liked this
-
ellduin liked this
-
jasonsjams liked this
-
yulianii liked this
-
kennygunie liked this
-
kennygunie reblogged this from cocoaheads
-
amirsaam reblogged this from cocoaheads
-
jimmyhansen liked this
-
inamiy liked this
-
ldrer liked this
-
shinyzhu liked this
-
sumitpaul liked this
-
seapomeranian reblogged this from cocoaheads
-
neoroman liked this
-
1thingtoday liked this
-
hengsu liked this
-
xeokeri liked this
-
guixing reblogged this from cocoaheads
-
asmallteapot reblogged this from cocoaheads
-
asmallteapot liked this
-
fannheyward reblogged this from cocoaheads
-
gabeprime liked this
-
iamitv reblogged this from cocoaheads
-
slowfocus liked this
-
slowfocus reblogged this from cocoaheads
-
elv1s liked this
-
weavsnake liked this
-
stiplady reblogged this from cocoaheads
-
tarnfeld reblogged this from cocoaheads
-
mike liked this
-
samsonjs liked this
-
samsonjs reblogged this from cocoaheads
-
mfisher liked this
-
gavinheer reblogged this from cocoaheads
-
dielaughing liked this
-
kadodka liked this
-
kadodka reblogged this from cocoaheads
-
iltofa reblogged this from cocoaheads
-
jemerick liked this
-
jagreenwood liked this
-
overcyn reblogged this from cocoaheads
-
royclarkson reblogged this from cocoaheads and added:
Exciting times we live in.
-
royclarkson liked this
-
jstn liked this
- Show more notes
