Michael Long
1 min readSep 9, 2019

--

“So, by this, we understand that the Observer/Notification is a communication pattern, based on many to one. By many, we meant the Notification(s) and by one we mean the Observer.”

By my understanding this is backwards. You have one notification type, which may have many observers. The design pattern is one-to-many.

The fact that there may be more than one notification flowing to a given observer is irrelevant to the architectural design pattern.

Especially as it’s entirely possible to have no notifications generated. (e.g. several screens subscribe to the notification sent on device rotation, but the user never rotates the device.)

The same goes for Combine/RxSwift where you have a single publisher/subject which may send zero, one or more events to multiple subscribers. One subject, many subscribers. One-to-many.

--

--

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

No responses yet