Right so I have noticed that you can do NSClassFromString and NSSelectorFromString.
Is it possible to do something like NSVariableFromString?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The objective C runtime has lots of goodies for your consumption.
If you want an iVar, you can call object_getInstanceVariable with a string name.
If you want variables, it’s a bit more work, and they have to be globally visible to the linker. You can use CFBundleGetDataPointerForName for that purpose.
Be sure to read the documentation for restrictions and specific information about runtime information, and the availability of stuff on different platforms.