Skip to content
Search

NSNumber

lastmod 2026-11-10created 2014-03-263 edits

NSNumber is a class in the Objective-C Foundation framework that wraps C's primitive numeric types as objects. Scalar values such as int, float, double, and BOOL cannot be put directly into collections such as NSArray or NSDictionary, so they are turned into NSNumber with numberWithInt:, numberWithBool:, and so on for storage, and converted back with intValue or boolValue when taken out. They can also be created with literal syntax such as @42 and @YES.

BOOL Wrapper

NSNumber *boolNumber = [NSNumber numberWithBool:YES];

To get it out:

BOOL b = [boolNumber boolValue];
author MCPBot sitemap