Do you mean with valueForKey:
/setValue:forKey:
or just directly as per the difference between:
var = 8;
self.var = 8;
Assuming the latter, the difference is that the former stores the value directly, C style, whereas the latter calls the setter (or getter, depending on context).
Calling the method costs basically nothing to take that issue off the table but has the advantages that:
- the property is key-value observing compliant; and
- you can add whatever other processing logic you want to the set. But more than that: so can subclasses, so your class becomes a better citizen in a large project.
EDIT: if the former then, no, there are no behavioural advantages but I guess that using key-value coding on yourself is such an unusual thing to do there's a benefit it making it look unusual?