Summary

In this chapter, we jumped deep into Swift and the unique and most advanced features that lie in its powerful type system. Now, protocols with and without associated type and generics, as well as type erasure patterns, should hold no secrets for you.

Now you should be able to effectively employ protocols and their associated types and understand the difference between associated types and generics.

New and powerful features such as conditional conformance should now be mastered and you should be comfortable refactoring your code base to take advantage of it. Lastly, you can use this as a handbook to implement the type erasure pattern and come back to it every time you have a question around this hot topic.

This chapter concludes the second part of this book, which covered most of the well known object-oriented design patterns as well as some Swift specific goodies. As you may have understood now, protocols are a large part of Swift language and are helpful in a variety of situations.

The next part will focus on application architecture and how Swift features help you write better and more maintainable programs.