From 427103acae2b2f77278d3872388135262b016e31 Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Tue, 30 Jan 2024 22:23:34 +0300 Subject: [PATCH] remove outdated actions and swift tools version --- Package.swift | 2 +- Sources/TableDirector.swift | 11 ++--------- Sources/TableKit.swift | 3 --- Sources/TableRow.swift | 24 +++--------------------- 4 files changed, 6 insertions(+), 34 deletions(-) diff --git a/Package.swift b/Package.swift index 4ef735d..c1e225f 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.7 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift index 1f41359..f4f05bf 100644 --- a/Sources/TableDirector.swift +++ b/Sources/TableDirector.swift @@ -346,13 +346,7 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { open func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { return sections[indexPath.section].rows[indexPath.row].isEditingAllowed(forIndexPath: indexPath) } - - @available(iOS, deprecated: 11, message: "Use leadingSwipeActionsConfigurationForRowAt(:_) and trailingSwipeActionsConfigurationForRowAt(:_) instead") - open func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { - return sections[indexPath.section].rows[indexPath.row].editingActions - } - - @available(iOS 11, *) + open func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { let currentRow = sections[indexPath.section].rows[indexPath.row] @@ -362,8 +356,7 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { return configuration } - - @available(iOS 11, *) + open func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { let currentRow = sections[indexPath.section].rows[indexPath.row] diff --git a/Sources/TableKit.swift b/Sources/TableKit.swift index aeec6b6..607c996 100644 --- a/Sources/TableKit.swift +++ b/Sources/TableKit.swift @@ -40,9 +40,6 @@ public protocol RowActionable { var leadingContextualActions: [UIContextualAction] { get } var trailingContextualActions: [UIContextualAction] { get } var performsFirstActionWithFullSwipe: Bool { get } - - @available(iOS, deprecated: 11, message: "Use leadingContextualActions, trailingContextualActions instead") - var editingActions: [UITableViewRowAction]? { get } func isEditingAllowed(forIndexPath indexPath: IndexPath) -> Bool diff --git a/Sources/TableRow.swift b/Sources/TableRow.swift index 211e6c0..b3b0659 100644 --- a/Sources/TableRow.swift +++ b/Sources/TableRow.swift @@ -24,9 +24,6 @@ open class TableRow: Row where CellType: UITableView public let item: CellType.CellData private lazy var actions = [String: [TableRowAction]]() - - @available(iOS, deprecated: 11, message: "Use leadingContextualActions, trailingContextualActions instead") - open private(set) var editingActions: [UITableViewRowAction]? open var leadingContextualActions: [UIContextualAction] { [] @@ -64,17 +61,6 @@ open class TableRow: Row where CellType: UITableView return CellType.self } - @available(iOS, deprecated: 11, message: "Use leadingContextualActions, trailingContextualActions instead") - public init(item: CellType.CellData, - actions: [TableRowAction]? = nil, - editingActions: [UITableViewRowAction]? = nil) { - - self.item = item - self.editingActions = editingActions - - actions?.forEach { on($0) } - } - public init(item: CellType.CellData, actions: [TableRowAction]? = nil) { @@ -108,13 +94,9 @@ open class TableRow: Row where CellType: UITableView return invoke(action: .canEdit, cell: nil, path: indexPath) as? Bool ?? false } - if #available(iOS 11, *) { - return !leadingContextualActions.isEmpty - || !trailingContextualActions.isEmpty - || actions[TableRowActionType.clickDelete.key] != nil - } else { - return editingActions?.isEmpty == false || actions[TableRowActionType.clickDelete.key] != nil - } + return !leadingContextualActions.isEmpty + || !trailingContextualActions.isEmpty + || actions[TableRowActionType.clickDelete.key] != nil } // MARK: - actions -