简体   繁体   中英

Saving reordering cells in UITableViewController with Core Data

I'm looking for simple implementation of saving reordering cells in UITableViewController with Core Data.

Now I'm using the default function for reorder cells:

var timers: [Timers] = []

    override func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {

    let movedObject = timers[sourceIndexPath.row]
    timers.remove(at: sourceIndexPath.row)
    timers.insert(movedObject, at: destinationIndexPath.row)


    }

How I can implement Core Data for saving cell ordering feature?

You need to re-save the array again every leave of that vc say inside deinit

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM