Foundation Classes

The Foundation framework is a collection of Objective-C classes. As the name implies, these are very useful primitive classes that will be at the base of most apps you build.

The root class. All classes you will define will inherit from NSObject.

An object wrapper for the primitive number types (int, float, double, BOOL, …).
NSNumber allows you to use primitives wherever an NSObject is required.

The base string class.
NSString is immutable, meaning it cannot be changed once it is created. If you need an editable string, you must use NSMutableString.

An ordered collection of objects, accessible by index. As always, indices start at 0.

NSArray is immutable. If you need a dynamic array, you must use NSMutableArray. This is similar to a Vector in Java.

You can iterate through an NSArray using the for-in syntax.

A collection of objects accessible by key. A key can be any NSObject but must be unique. If you use the same key twice, the first object associated with it will be replaced. This is similar to a Map in Java.

NSDictionary is immutable. If you need a dynamic collection, you must use NSMutableDictionary.

You can also iterate through the keys of an NSDictionary using the for-in syntax.

Comments are closed.