Using observation

We have covered three different techniques to implement the observer pattern in this section. Each technique comes with its set of constraints and advantages.

  1. NotificationCenter, which can become resource-intensive
  2. KVO observation, which requires deep integration with Objective-C
  3. Pure Swift setters, which restrict the number of observers to one

In practice, you'll find yourself using all three techniques over time, as they are core to Swift and Foundation-based programming in general.