Amogh Talpallikar
Amogh Talpallikar

Reputation: 12184

Is it fine to use Core Data's NSManagedObjects instead of Normal Objects?

If My app has a Model class called Note.

At the moment I have to Just create a Text Note and call an API and send it to the server.

But there are chances that later on, I will have to bring GMail style, draft facility for this Note.

So is it fine that I make it a Core Data entity upfront ?

I will pass nil for context for now, and when I will implement this feature I will pass the context of my application while creating it.

Also it feels nice to be able to control all the Models, whether being persisted or not, from the same interface.

So that I can use the Core Data's Graphical interface to add and remove properties as required and aut-generate files unlike a hand-written NSObject models.

Can this have a performance hit or any other con ?

Upvotes: 0

Views: 74

Answers (1)

Daij-Djan
Daij-Djan

Reputation: 50089

mostly, this is fine and when their is no context involved I don't see a problem

BUT

you have to take care with threading Once you pass a context. the contexts and the MOMs that belong to them belong to a certain thread and cannot freely be passed around between threads!

Upvotes: 1

Related Questions