Is there a way in Objective-C to set a property value of a class instance X without directly invoking the setter, but just somehow specifying the property name ?
I have a NSDictionary in which the keys are the property names and the values are the values to assign.
Now I just would like to iterate my NSDictionary and set the property of the instance X by just specifying the key.
I hope it is clear…
thanks
You can do this using Key Value Coding. Just use the
setValue:forKey:andvalueForKey:methods to set and get properties. Behind the scenes those will use the setters if available, but they also can access ivars directly, if there are no accessors.