The Observer pattern is useful for when you need to maintain consistency between classes, while also maintaining their reusability. The two key terms to become familiar with in this pattern are subject and observer. A subject may have many observers dependent on it. When the subject changes state, all of the observers will be notified. Each observer will then query the subject for its value (or have it passed in the original notification), and then sync its state with the subject's state.

This pattern can be useful for cases in which you need to update the user interface (UI) in response to changes in the model (data).

Swift Implementation