Swift4構文で書かれている記事を見掛けなかったので書かせて頂きました
間違いなどありましたら教えて下さると助かります
//テスト配列
var todoList:[String] = ["todo01","todo02","todo01","todo03","todo04"]
//並び替えが終わったタイミングで呼ばれるメソッド
func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
//sourceIndexPath にデータの元の位置、destinationIndexPath に移動先の位置
//CellValueを取得
if let targetTitle = todoList?[sourceIndexPath.row]{
//元の位置のデータを配列から削除
todoList?.remove(at:sourceIndexPath.row)
//移動先の位置にデータを配列に挿入
todoList?.insert(targetTitle, at: destinationIndexPath.row)
}
}