TableViewで最初の3つのセルは並び替え不可、それ以降は並び替えできるようにしたく、Sectionを分けたが、Sectionを超えて並び替えできてしまった。
ViewController.swift
override func tableView(_ tableView:UITableView, targetIndexPathForMoveFromRowAt sourceIndexPath: IndexPath, toProposedIndexPath proposedDestinationIndexPath: IndexPath) -> IndexPath {
if (proposedDestinationIndexPath.section != sourceIndexPath.section) {
return sourceIndexPath
}
return proposedDestinationIndexPath;
}
以上のようにすればSectionを超えた場合はうごかないように