From 337175c507abc79fc9c955de170de3efab4952b5 Mon Sep 17 00:00:00 2001 From: Bogdan Kurpakov Date: Thu, 9 May 2019 11:10:31 +0200 Subject: [PATCH] added: willDeselect --- Sources/TableDirector.swift | 8 ++++++++ Sources/TableKit.swift | 1 + 2 files changed, 9 insertions(+) diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift index aa6473b..e6f16c7 100644 --- a/Sources/TableDirector.swift +++ b/Sources/TableDirector.swift @@ -309,6 +309,14 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { return indexPath } + open func tableView(_ tableView: UITableView, willDeselectRowAt indexPath: IndexPath) -> IndexPath? { + if hasAction(.willDeselect, atIndexPath: indexPath) { + return invoke(action: .willDeselect, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? IndexPath + } + + return indexPath + } + // MARK: - Row editing open func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { return sections[indexPath.section].rows[indexPath.row].isEditingAllowed(forIndexPath: indexPath) diff --git a/Sources/TableKit.swift b/Sources/TableKit.swift index 5d554d5..3eb96a4 100644 --- a/Sources/TableKit.swift +++ b/Sources/TableKit.swift @@ -69,6 +69,7 @@ public enum TableRowActionType { case select case deselect case willSelect + case willDeselect case willDisplay case didEndDisplaying case shouldHighlight