Anyone working with Core Data may appreciate this short category I wrote, with some help from Jim Dovey. Curiously enough, managed objects don't know if they are new or not. That is to say, whether they've been added to the context since the last load or save. I've found this to be a piece of information I've needed a lot, so wrapped up the check into a category.
NSManagedObject-isNew.h
//
// NSManagedObject-IsNew.h
NSManagedObject-isNew.m
//
// NSManagedObject-IsNew.m
//
Then you can just add these files to your project, #import the header file, and then you can ask any managed object if it's new by sending it an isNew message.
0 komentar:
Posting Komentar