Make #define from core data class property

//Make #define from core data class property

Make #define from core data class property

Core data is an incredible interface between the underlying database and you as a programmer.
Though there are many things which need a deeper understanding of how core data handels things you’ll notice steep learning curve.

Once you have your model defined and core date generated your accessor methods you’re ready to start.

You access core data class properties in KVC manner wether with dot syntax „myClass.myProperty“ or

[myClass valueForKey:@“myProperty“].

In the second case it wouldn’t it be nice to have a unique identifier used through all your classes and whenever it comes to property name changes only one place needs to be changed.
You might say a global search and replace is a good remedy but what if you have to classes with the same property name?

If you faced the same problem use the automator service attached to convert a @dynamic myPropertyName captured from the .m file to #define k_PRE_MyPropertyName @“myPropertyName“ and replace the _PRE_ with whatever you find appropriate to distinguish the same property names between different classes.

Download the automator action here

By |2018-06-06T20:31:58+00:00Dienstag, August 30th, 2011|Development|0 Comments

About the Author:

Leave A Comment

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.