21

Two Ways of Implementing AnySomething

Sometimes, we can use a protocol as a standalone type. However, with a protocol like IteratorProtocol, this isn’t (yet) possible, because it has an associated type. The compile error says: “Protocol ‘IteratorProtocol’ can only be used as a generic constraint because it has Self or associated type requirements.”

Read more