Extensions allow you to add new methods and computed properties to any type, not just types you have defined. Likewise, protocol extensions allow you to add new methods and computed properties to any protocol. However, as we said earlier, the properties and methods you add in a protocol extension can only use other properties and methods that are guaranteed to exist.
Do you remember the built-in protocol Sequence from Chapter 22?
It has an
Iterator, which must itself conform to IteratorProtocol.
And IteratorProtocol has an
Element that indicates the type of elements produced by the generator.
When writing a protocol extension on Sequence, there are not ...