0
votes

I'm new to Core Data, and currently using it to save API server response in an IOS App, using AFNetworking : I have a couple models like Conversations and Messages, I want to allow users to view theirs even if there is no Network.

I was previously using NSObjects and parsing JSON, which was working well.

Does it sound strange to have 2 Objects For the same class : the current NSObject and the equivalent CoreData Managed Object?

  1. With both NSObjects and NSManagedObjects for the same class

enter image description here

  1. With only NSManagedObjects

enter image description here

In the case 2), when using only NSManagedObjects, I have to wait to create and fetch the NSManagedObjects whereas in the case of using both I can do the core data save in the background and don't wait for that save to display it to user.

Any recommendations on which way to go, or any better alternative I did not consider?

1

1 Answers

1
votes

NSManagedObject is a subclass of NSObject, so solution 2 is the only way to go.

As for saving, this does not necessarily take much time. Also, if you use a NSFetchedResultsController to display the items, even in-memory changes (before saving the context) will be caught by its delegate methods