Search code examples
iphonecocoa-touchkey-value-observingkey-value-coding

KVO rocks. Now how do I use it asynchronously?


I am sold on KVO but if used in the obvious way it is synchronous. I would like to use it in a situation where I am firing off many KVO messages in rapid succession and it is causing my app to grind to a halt as the KVO messages are handled. Can someone suggest an approach - perhaps using NSOperation or NSThread - that will work here?

My goal is to retain the decoupled, flexibility of KVO if possible.


Solution

  • Check out NSNotification. It's not quite the same thing, but you can fire off notifications on background threads (with a little bit of research and work). You can maintain the nice decoupling and fire-and-forget behavior.