NSDictionary/NSMutableDictionary

A dictionary is a collection of key-value pairs. The key is typically a string, and the value can be any sort of object. Dictionaries are indexed by key: you provide a key and get back the value (an object) associated with that particular key. Keys in a dictionary are unique and a dictionary’s key-value pairs are not kept in any particular order.

Like arrays and sets, dictionaries can be mutable (NSMutableDictionary) or immutable (NSDictionary). Like NSArray, NSDictionary has a shorthand you can use when creating an immutable dictionary. The dictionary literal syntax is formed with the @ symbol and curly braces. Within the curly braces, you provide a comma-delimited list of the key-value pairs and ...

Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.