Chapter 2. Working with Collections

The last chapter covered a lot of Swift’s basics, with plenty of examples (including intentional mistakes) in order to reinforce the concepts of variables, constants, and types. As you’ll see, the information in Chapter 1 will come in handy in this and subsequent chapters.

For this chapter, get ready to turn your attention to the notion of collections.

When you think of a collection, what comes to mind? Here are several examples of collections you might have had at one time or another:

Image Assortment of toy action figures and accessories

Postage stamps or coins from different countries

Shopping list of items to ...

Get Swift for Beginners: Develop and Design, Second Edition 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.