Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create temporary CoreData entities (in a non-persistent MagicalRecord context)?

I simply want to create entities yet not to be saved, only inspect them.

Can I create a temporary context for those? Is there a way to move them into the persistent context once I decided to store them?

And the point: are these features available trough MagicalRecord API?

like image 301
Geri Borbás Avatar asked Dec 25 '22 15:12

Geri Borbás


1 Answers

Create a new NSManagedContext that has parentContext property set to your main context, and create new objects in the new context - you can do everything you want with those objects, then later either save the new context (this will move the objects to the main context) or just discard it - the objects will be gone.

Seems that there stands an +(NSManagedObjectContext*)MR_contextWithParent: for that in MagicalRecord.

like image 200
Peter Sarnowski Avatar answered Dec 28 '22 09:12

Peter Sarnowski