From 0c75d7547082286e7b802af1b5c87b23d2f12e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hamza=20=C3=96zt=C3=BCrk?= Date: Wed, 23 Dec 2020 12:06:15 +0300 Subject: [PATCH] Update RequestListController.swift Deprecated tableview method updated. --- .../Requests List/RequestListController.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/SwiftLocationPlayground/SwiftLocationPlayground/View Controllers/Requests List/RequestListController.swift b/SwiftLocationPlayground/SwiftLocationPlayground/View Controllers/Requests List/RequestListController.swift index 0f822606..8f4861f9 100644 --- a/SwiftLocationPlayground/SwiftLocationPlayground/View Controllers/Requests List/RequestListController.swift +++ b/SwiftLocationPlayground/SwiftLocationPlayground/View Controllers/Requests List/RequestListController.swift @@ -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) {