I have a very weird issue using the iOS 11 SDK.
When setting the editing flag of a UITableView on iOS 11 devices and simulators to false after deleting a cell using the swipe gesture, it still stays true the next line after set.
On iOS 10 devices and below the flag is set correclty to false.
Please have a look at this short example.
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: UITableViewCell = tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as UITableViewCell!
return cell
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
tableView.deleteRows(at: [indexPath], with: .fade)
endEditingMode()
}
}
func endEditingMode() {
tableView.setEditing(false, animated: true)
// Here we expect `isEditing = false` since it is set the line before but it is still `true` on iOS 11 devices
// On <= iOS 10 devices however its `false`
print(tableView.isEditing)
}
Anyone experiencing similar issues and probably knows how to solve this? I have already created a radar for apple.