UiTableView Swipe Actions at left or leading on iOS10

347 Views Asked by At

I am developing app support iOS9 & iOS 10 and later I want to Add edit actions to table view rows I know it's been possible since iOS 8 but only on the right (trailing) side. The new style swipe actions added in iOS 11 both sides.

But my question is there any way to swipe cell from the left in iOS9 & iOS 10

enter image description here

here is the add action before ios 11

override func tableView(_ tableView: UITableView,
  editActionsForRowAt indexPath: IndexPath)
  -> [UITableViewRowAction]? {

  let deleteTitle = NSLocalizedString("Delete", comment: "Delete action")
  let deleteAction = UITableViewRowAction(style: .destructive,
    title: deleteTitle) { (action, indexPath) in
    self.dataSource?.delete(at: indexPath)
  }

  return [deleteAction]
}

And for iOS 11+

override func tableView(_ tableView: UITableView,
  leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath)
  ->   UISwipeActionsConfiguration? {
}

other side

override func tableView(_ tableView: UITableView,
      trailingSwipeActionsConfigurationForRowAtIndexPath indexPath: IndexPath)
      ->   UISwipeActionsConfiguration? {
    }
0

There are 0 best solutions below