Protocol Composition In Swift

If we want to write clean code, we should split our interface in little protocols with cohesive properties and methods. The problem of having several protocols is that we often need to use some of them together. For example, we may want to declare a variable of a type which combines some protocols together. The solution is using protocol composition.

In this article, we’re going to see two approaches to achieve protocol composition in Swift.


Want to receive more content like this in your inbox?