Reputation: 2863
Im justing wondering whether there is a way in Xcode obj-c to get all properties of an object (unknown type by code) programatically and than therefore loop through all the properties and obtain the value. I know how to do it in the .net world using reflection, but don't know how to do it in the objective-c.
Any ideas?
Thanks in advance
Upvotes: 2
Views: 2024
Reputation: 124997
You'll want to read the Objective-C Runtime Programming Guide and Objective-C Runtime Reference. You'll find functions in the Objective-C runtime such as class_copyIvarList()
, class_copyMethodList()
, object_getInstanceVariable()
, and so on. You can use these to perform all the introspection you like.
Upvotes: 8