Say I have my class
@interface Person : NSObject { NSString *name; }
I need to get the name of NSString\'s within my class
You can get the names of a class's instance variables with the Objective-C runtime API function class_copyIvarList
. However, this is rather involved, rarely done and almost never the best way to accomplish something. If you have a more specific goal in mind than mere curiosity, it might be a good idea to ask about how to accomplish it in Objective-C.
Also, incidentally, person.name
doesn't specify an instance variable in Objective-C — it's a property call. The instance variable would be person->name
.