Objective-C get a class property from string

The Key Value Coding mechanism allows you to interact with a class’s properties using string representations of the property names. So, for example, if your Record class has a property called column1, you can access that property as follows:

NSString* dataToGet = @"column1";
id value = [myRecord valueForKey:dataToGet];

You can adapt that principle to your specific needs.

Leave a Comment