KVO vs Notification Center
One-to-Many or One-to-One
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 is in the now can we?
Read on to find better English. Or watch the following video:
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 broadcast to many observers — a one-to-many…