In the new Swift API design guidelines, the commonly-used Type
suffix for protocols is being dropped. While this is easy to do for protocols that are stand-alone (SequenceType
becomes Sequence
), I'm not sure how to update my APIs in which a protocol provides the base for an implementation. Here's some examples from popular frameworks:
- The Result µframework provides
Result
, a concrete success/fail enumeration, andResultType
, a generic base protocol for a success/fail type, to whichResult
conforms. - ReactiveCocoa's main types are
Signal
andSignalProducer
, which are backed bySignalType
andSignalProducerType
.
In both cases, much of the implementation is in extensions of the protocols, allowing extensions to use the full power of type constraints, and allowing the implementations to be generic. This is different from the case of protocols with AnySequence
-style type-erasing types: you aren't really expected to implement these protocols on your own, or unify disparate types.