I have an iOS
project I'm working on using Xcode7
and Swift2
. I have a TableView
that fetches an array
from NSCoding
. I have it started so the user can reorder the TableViewCells
in the TableView
. However I need it to save the new order once the user is finished and clicks 'done' which is a UIBarButtonItem
. I have a value in my NSCoding
object
called cellOrder
. I looked here and saw this for CoreData
. How how would I do this for NSCoding
and where do I save it?
I have the following code started for the TableViewCell
movement:
func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true}
func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
let itemToMove = details[fromIndexPath.row]
details.removeAtIndex(fromIndexPath.row)
details.insert(itemToMove, atIndex: toIndexPath.row)
}
details
is the array my data is kept in, using NSCoding
.