I am moving rows inside a collectionView, I have no sorting on the data so all new cells are inserted at the end of the table, but when I move a cell I want to specifically select the index where it should be moved inside the entity in core data, this way the collectionView will automatically display the moved cell at the updated row without any additional work, is that possible without creating an additional ID attribute?
The entity is named List and it has two attributes, task_name and task_bool.
var myData:[NSManagedObject] = []
let appDelegate =
UIApplication.sharedApplication().delegate as! AppDelegate
let managedContext = appDelegate.managedObjectContext!
let newItem: AnyObject = NSEntityDescription.insertNewObjectForEntityForName("List",
inManagedObjectContext:
managedContext)
var deleltedRow = myArray[indexPath.row].valueForKey("task_name") as! String
myData.removeAtIndex(indexPath.row)
newItem.setValue(deleltedRow, forKey: "task_name"); // how would I add atIndex: here??
newItem.setValue(true, forKey: "task_bool"); // how would I add atIndex: here??