Skip to content

Commit

Permalink
Update RequestListController.swift
Browse files Browse the repository at this point in the history
Deprecated tableview method updated.
  • Loading branch information
hamzaozturk authored Dec 23, 2020
1 parent bcbf8d1 commit 0c75d75
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,18 @@ class RequestListController: UIViewController, UITableViewDelegate, UITableViewD
}
}

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
guard indexPath.section > 0 else {
return nil
}

return [
UITableViewRowAction(style: .destructive, title: "Stop Monitor", handler: { [weak self] (_, indexPath) in
DispatchQueue.main.async {
self?.cancelRequestAtIndexPath(indexPath)
}
})
]
let action = UIContextualAction(style: .destructive, title: "Stop Monitor") { [weak self] (action, view, completionHandler) in
self?.cancelRequestAtIndexPath(indexPath)

completionHandler(true)
}

return UISwipeActionsConfiguration(actions: [action])
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
Expand Down

0 comments on commit 0c75d75

Please sign in to comment.