Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You can extend a mutable dictionary by adding new items or reduce it by removing items. You’ll see how to create a mutable dictionary in this task, and you’ll see how to extend it in code in the next task.
To create a mutable dictionary:
1. | Create a new program named createmutabledictionary.m. |
2. | In createmutabledictionary.m, enter the code shown in Listing 9.18. This code creates an object of the NSMutableDictionary class. |
3. | Add the code to display a message indicating that the creation process went smoothly and to deallocate the memory used by the mutable dictionary before ending the program (Listing 9.19). |
4. | Save createmutabledictionary.m. |
5. | Run the createmutabledictionary.m program. You should see the following: Created mutable dictionary. |