Quick takeaways
I covered a lot of stuff in a just a few pages on collection types in Swift 3. Here are the highlights to keep in mind about the collections and indices.
Collection types (built-in and custom) implement the Collection protocol.
Iterating over collections has moved to the Collection - the index no longer has that ability.
You can create your own collections by adopting the Collection protocol. You need to implement:
startIndex
andendIndex
properties,The subscript method to support access to your elements
And the
index(after: )
method to facilitate traversing your collection's indices.