Reputation: 119
I'm busy creating an iOS app in Swift 3 for iOS 8+ with CoreData.
I've a tableview with tasks. The tasks are retrieved from an API and each task from the JSON is inserted in a new NSManagedObject "Task". All these "Task" NSManagedObjects are stored in an array so that I have an array with all the "Task" objects from the JSON. Then I populate the tableview with that array of "Task" NSManagedObjects. But, when a user taps on a row, that single "Task" object have to be saved in CoreData (in the "Task" entity).
How can I populate the tableview with "Task" NSManagedObjects without saving all the tasks but only the one that the user taps?
Can anybody point me in the right direction?
Upvotes: 0
Views: 144
Reputation: 285270
You could use an intermediate custom struct.
NSManagedObject
and save it.Upvotes: 1