Dok-tips for Foundation class NSNumber

Immutable wrapper for a single numerical value

Inline instances created with @( )

DO NOT EVER subclass - use its various methods to retrieve the number in various formats (float, int, etc.)

Useful when numerical information needs to be handled like an object - otherwise, use of traditional c types for numbers is available in Objective-C

New syntax available in iOS 6 for creating NSNumbers - see inline instantiation of objects


NSNumber *n = [NSNumber numberWithInt:25];
float f = [n floatValue]; // would return 25.0 as a float