In Swift, there are three collection types (for simplicity, we will discuss only mutable collections):
- Array: An ordered (indexed) list of values which are from the same data type
- Set: An unordered collection of unique values from the same data type
- Dictionary: An unordered collection map (key -> value), which links a key with a value, and the keys should be unique and from the same data type
Each collection has a fixed data type and there is no way to store values from different data types in the collection. This will become clear later in the chapter.
Array, dictionary, and set are implemented using generics and are called generic collections.