KVOController 1.0.0 supports observing arrays and other ordered relationships, just not values within. I filed https://github.com/facebook/KVOController/issues/5 to track. Features requests are welcome.
Performing the initial callback manually, avoiding the KVO initiated one, was shown to be a performance improvement under certain KVO configurations.
We've updated the readme to include an example tracking the controller object. An instance variable should all that is necessary: https://github.com/facebook/KVOController.
> Performing the initial callback manually, avoiding the KVO initiated one, was shown to be a performance improvement under certain KVO configurations.
Please elaborate. I've been re-implementing KVO, and have not seen this. What configurations?
Also, adding a controller ivar/property is rather invasive, don't you think?
This was the principal motivation behind KVOController. Manually tracking registered observers is tedious and error prone. We hope you give KVOController a try, feedback from the community is welcome.
This is a useful collection of links. One point of note, Facebook's solution doesn't rely on swizzling. Much like THObserversAndBinders, KVOController ties observation to the controller scope.
We use a shared controller instance, that acts as a receptionist for all KVO notifications, as well as a weak reference to the observer, in order to safely allow observer removal on dealloc.
By controller does the readme refer to the KVOController instance?
I assume this is a property on the class that uses it, and once the class gets dealloced, its observer also get dealloced?
FBKVOController
Hmm... I think this is a much better idea! Much cleaner than what I current got going, but then again we don't offer the same api. Thanks for correcting me!
Correct. Add a strong reference from observer to KVOController instance via a property or instance variable and you've achieved un-observation on observer dealloc :)
This usage pattern is quite common. We'll look into calling this out more explicitly in the readme. Thanks for the feedback!
each product team at Apple is different. some pay close attention to duplicate counts when prioritizing radars, others don't.
if instead you wanted to read between the lines: please file a dupe (we have no idea when that will be fixed.) no need to file a dupe (oh cute, you're still running that ancient public build?)
Performing the initial callback manually, avoiding the KVO initiated one, was shown to be a performance improvement under certain KVO configurations.
We've updated the readme to include an example tracking the controller object. An instance variable should all that is necessary: https://github.com/facebook/KVOController.