Objective-C gets property value dynamically

I had an entity object, some properties are nil some arn't. I want to list all non-nil properties and corresponding values.

For example my entity looks like:

allValuesWithAuthFields: returns a dictionary with property name as key, property value as value.

The engine part:

Oh, be sure you import objc/message.h, #import <objc/message.h>.

As you can see I use a marco @keypath(self, type) instead of a pure string.
Which is EXTKeyPathCoding provided by libextobjc, automatically checks key paths at compile-time.

comments powered by Disqus