The tableView(_ tableView: UITableView, editingStyleForRowAt in a class results in inconsistent behaviour in IOS 9.3 & IOS 10+

190 Views Asked by At

Using the following code in a class that has more than one edit action - slide to left and move row results in IOS 9.3 devices not allowing the slide to left but allows the move. Both actions work fine in IOS 10+. Removing this code allows 9.3 & 10+ to do both actions however the red delete button now appears on the left when a move row action is instituted

func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
    return .none
}

The code is in an UIViewController class which has a table that has a single prototype cell.

Every other feature works without any issues.

Is there any way to selectively call this function. ie call it only for IOS 10+ devices?

1

There are 1 best solutions below

1
maxwell On

If you wand to use something for certain iOS:

if #available(iOS 10.0, *) {
        //do what you need
}

But you can specify this already in the function itself.