Member-only story
KVO vs Notification Center
One-to-Many?
I’ve previously covered the Observer Pattern in Swift, but there seems to be two implementations in the iOS SDK -
- NotificationCenter
- KVO
So which is what, and what might be the best approach for your application?
If you would like the background to this, please do take a look at my Observer Pattern article.
Prerequisites:
You will be expected to be aware how to make a Single View Application in Swift, or be able to code in Swift Playgrounds.
Terminology:
NotificationCenter: A notification dispatch mechanism that enables the broadcast of information to registered observers
Dynamic property: An interface for a stored variable that updates an external property of a view
NotificationCenter
Notification Center enables the broadcast of information to any registered observers. This means that a single event can…