We look at multiple ways to create variables that have a class type but also conform to a protocol.
In this last episode of our collection series, we make our custom IndexSet collection type conform to the Collection protocol, implementing a custom index type along the way.
In this episode, we make a custom collection conform to Sequence. This allows us to efficiently iterate over the elements, and we gain all the useful functionality of Sequence.
We show how to make an extension on array available to other collections: first, we implement it for array slices, then we implement it as a protocol extension for all collections.