I have a retain property, which is an NSArray of child View controllers. I want to modify the setter of this property so that when the view controllers are set I set a property on the view controller containing a reference to self.
In the same way when you add a view controller to a tab bar controller, the view controllers tabBarController property is set.
Should I be creating a custom setter (rather than the synthesized one) or should /i be using key value observing I think I’ve heard about.
Although you could do it either way, my personal opinion would be to use a custom setter – if only because it would make it clearer for a third-party exactly what was doing what in the code. Using your own setter is probably more readable than setting up a key-value observer and having a method triggered upon a property change.
Also, from a computational perspective using KVO is more expensive than a custom setter. The impact in your application may be negligible, but it’s worth considering.