I am using Core Data in my application, and I have entities that need to be reordered. I have a collection view that is populated with NSManagedObjects from the data model, and this collection view can be reordered by dragging and dropping the cells. I want the order of the entities in the data model to reflect the order of the cells in the collection view. Does anyone know how I can accomplish this? I am new to Core Data, so I am still getting used to it.
If I understand your question correctly, you may do it simply as follows:
viewOrder to your entity, probably an integer typesave: the NSManagedObjectContext whenever you make any changes)NSFetchRequest property sortDescriptors to sort the results by viewOrderviewOrderIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With