Key points

  • Protocol extensions let you write implementation code for protocols, and even write default implementations on methods required by a protocol.
  • Protocol extensions are the primary driver for protocol-oriented programming

and let you write code that will work on any type that conforms to a protocol.

  • Type constraints on protocol extensions provide additional context and let you write more specialized implementations.
  • You can decorate a type with traits and mixins to extend behavior without requiring inheritance.

results matching ""

    No results matching ""