Summary

In this chapter, we looked at the final piece in the protocol-oriented programming puzzle: extensions. In the original version of Swift, we were able to use extensions to extend structures, classes, and enumerations but, starting with Swift 2, we are able to use extensions to also extend protocols.

Without protocol extensions, protocol-oriented programming would not be possible, but we need to make sure that we use protocol extensions where appropriate and do not try to use them where regular extensions should be used.

In the next chapter, we will look at how to use design patterns with Swift.