Most apps have some need to exchange data with and/or trigger behaviors in other objects. Doing so can lead to interdependent code that is hard to maintain and reuse. Instead, you can use protocols.
Protocols increase the maintainability, reusability, and flexibility of your code. You can think of a protocol as a contract between a requestor and a provider. The provider, or delegate as it is usually called, agrees to implement a set of methods that the requestor can call. Each method is usually used for one of three purposes:
To request data from the delegate, such as a
To inform the delegate of a ...