Implementing CollectionType in Swift 2.x
I ran into trouble with custom collections the other day and wondered how to reliably find out what the bare minimum for a custom CollectionType
is. The compiler will only help a bit: It’s conforming to neither CollectionType
nor SequenceType
. Now I know SequenceType
requires the generate()
method – but don’t let this fool you. CollectionType
will provide that for you if you meet its requirements.