Mediator Pattern - Swift
Let’s take an example first for understanding the problem (why this is needed?)
There were 3 friends in a school : Tom, Gary and Ramu
Three of them decided to track one another activities.
If Tom has finished a chapter of history Gary and Ramu like to know about it. Similarly when Gary has done with a chapter in history Tom and Ramu want to know about it.
Now If we have to design this and make an iOS app which serve above purpose how we gonna do this:
We will have 3 class Tom, Gary and Ramu and each class have reference to other 2 class.
Every class will have both send and receive method for this purpose.
This system is called as tightly coupled system.

Now, In order to solve these kind of problems mediator pattern is used where everyone communicates with mediator and then mediator take care of the rest.

