Sequence's protocol
is a Swift protocol, so all the methods it are required.
Taking a look at its declaration, I've seen now that there are a lot of methods such as
makeIterator(), map(), filter()
and so on...
I'm wondering why only
makeIterator()
method is required.
It's not a @objc protocol with optional keyword, it's not a protocol's extension, it doesn't not conform any other protocols. It's a simple Swift kind of protocol.
Any idea?
Sequencedoes provide default implementations for the rest of its requirements, e.gmap's default implementation is here,filter's default implementation is here. Note that there's also a default implementation formakeIterator()when the sequence is its own iterator. - Hamish