Chapter 7
Collecting Objects
In This Chapter
Working with mutable and immutable collections
Starting with arrays
Storing data in dictionaries
It’s often convenient to be able to group objects into collections so that you can handle them together. Whether you’re talking about students in a class, items in a desk drawer, or values in an array, collecting items together makes your code easier to read (and write!).
Swift has two types of collections: arrays and dictionaries. Arrays are the standard indexed collections of values that can be accessed by their index. Dictionaries are associative arrays in which the values are accessed by a key value and a hash routine.
Get Swift For Dummies 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.