I'm currently contemplating whether to use KVO or NSNotifications to alert several objects in my iOS app when a property of my singleton has changed.
Since all the objects that need to be notified of the change has a reference to the singleton, KVO would seem like the natural solution. However, I've never used KVO with a singleton and multiple observers, so I don't know if that pattern is advisable or even possible.
Is it a good idea (or even possible) to use KVO on a singleton with multiple observers?
Use NSNotifications when you can wait for the event loop.
Use KVO when you need immediate response to the change in state.
Use KVO in this is feasible, as the underlying Cocoa Framework has support built-in to notify the observers and you need not re-invent the wheel
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With