Objective-C literals for NSDictionary, NSArray, and NSNumber

From CocoaHeads:

To sum it up, you can create an NSDictionary through the following:

dict = @{ k1 : o1, k2 : o2, k3 : o3 };

Similarly for an NSArray:

array = @[ a, b, c ];

and for NSNumber:

NSNumber *number;
number = @'X';
number = @12345;
number = @12345ul;
number = @12345ll;
number = @123.45f;
number = @123.45;
number = @YES;

Find the entire article at CocoaHeads • Objective-C literals for NSDictionary, NSArray, and NSNumber.

0 Comments

Cancel