I've been struggling for some hours to achieve what seemed like a simple thing.
I have an Entity A with a NSDate attribute.
My goal is to build a UITableView that lists every A object while grouping them into sections defined by the MM/YYYY of their NSDate attribute.
I found this Apple official sample: http://developer.apple.com/library/ios/#samplecode/DateSectionTitles/Introduction/Intro.html
So:
I decided to move this new code to a Class Category (A+nonGenerated) because I didn't want everything to be wiped out each time I regenerate my model classes.
After that I updated my table view delegate so that
2 points make me wonder if this solution is good:
1) I'm using a transient attributes as a sectionNameKeyPath with a SQL Lite back-end. Is it ok ? I've read somewhere that transient attributes + SQLLite weren't good friends but can't remember in which cases
2) I'm defining properties (primitiveDate and primitiveSectionTitleMonth) in my class category A+nonGenerated. Is it ok ? Because as stated in the official doc "You cannot, however, use a category to add additional instance variables to a class". But here the properties are dynamic and I guess that core data generates the related instance variables when it generates A so it should work fine... but I still have a little doubt :)
Everything seems to work fine but... is it a good solution ? I mean is their any simpler / better way to achieve my goal ?
Please comfort me or give me a better solution :o)
Your approach seems fine. There is no apparent difference between having your accessors in the category class file or in the original. You are not violating the warning in the docs because you are not actually adding instance variables to the model class.