Chapter 4. Digging into Collections
In the last couple of chapters, we reviewed the basics of Swift to get you warmed up. Before we start building our app, we need to look at one more programming concept—collections. In Swift, we have three primary collection types, which we will cover in this chapter:
- Arrays
- Dictionaries
- Sets
We will dig deeper into each one, but we will start with the most common collection type—arrays.
Arrays
Arrays are an ordered collection of values and can hold any number of items. For example, a list of Strings, Ints, floating-point values, and so on. Arrays are stored in an ordered list, starting at 0. Let's look at a diagram:
Starting from left to right in the preceding examples, we first have an array that holds a collection ...
Get iOS 10 Programming for Beginners 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.