From 4886e43d20c083dc9541b73fee78763ba786226a Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Tue, 30 Jan 2024 21:57:42 +0300 Subject: [PATCH] fix warnings --- Package.swift | 3 +++ Sources/ExpandableCellViewModel.swift | 2 +- Sources/TableDirector.swift | 30 +++++++++++++-------------- Sources/TableKit.swift | 6 ------ Sources/TableRow.swift | 10 +++------ TableKit.podspec | 6 +++--- 6 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Package.swift b/Package.swift index 5ce7c3d..4ef735d 100644 --- a/Package.swift +++ b/Package.swift @@ -5,6 +5,9 @@ import PackageDescription let package = Package( name: "TableKit", + platforms: [ + .iOS(.v12) + ], products: [ .library( diff --git a/Sources/ExpandableCellViewModel.swift b/Sources/ExpandableCellViewModel.swift index 40c893b..7a973e3 100644 --- a/Sources/ExpandableCellViewModel.swift +++ b/Sources/ExpandableCellViewModel.swift @@ -1,4 +1,4 @@ -public protocol ExpandableCellViewModel: class { +public protocol ExpandableCellViewModel: AnyObject { var expandableState: ExpandableState { get set } diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift index e269398..1f41359 100644 --- a/Sources/TableDirector.swift +++ b/Sources/TableDirector.swift @@ -414,36 +414,36 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { extension TableDirector { @discardableResult - open func append(section: TableSection) -> Self { + public func append(section: TableSection) -> Self { append(sections: [section]) return self } @discardableResult - open func append(sections: [TableSection]) -> Self { - + public func append(sections: [TableSection]) -> Self { + self.sections.append(contentsOf: sections) return self } @discardableResult - open func append(rows: [Row]) -> Self { - + public func append(rows: [Row]) -> Self { + append(section: TableSection(rows: rows)) return self } @discardableResult - open func insert(section: TableSection, atIndex index: Int) -> Self { - + public func insert(section: TableSection, atIndex index: Int) -> Self { + sections.insert(section, at: index) return self } @discardableResult - open func replaceSection(at index: Int, with section: TableSection) -> Self { - + public func replaceSection(at index: Int, with section: TableSection) -> Self { + if index < sections.count { sections[index] = section } @@ -451,20 +451,20 @@ extension TableDirector { } @discardableResult - open func delete(sectionAt index: Int) -> Self { - + public func delete(sectionAt index: Int) -> Self { + sections.remove(at: index) return self } @discardableResult - open func remove(sectionAt index: Int) -> Self { + public func remove(sectionAt index: Int) -> Self { return delete(sectionAt: index) } @discardableResult - open func clear() -> Self { - + public func clear() -> Self { + rowHeightCalculator?.invalidate() sections.removeAll() @@ -474,7 +474,7 @@ extension TableDirector { // MARK: - deprecated methods @available(*, deprecated, message: "Use 'delete(sectionAt:)' method instead") @discardableResult - open func delete(index: Int) -> Self { + public func delete(index: Int) -> Self { sections.remove(at: index) return self diff --git a/Sources/TableKit.swift b/Sources/TableKit.swift index 1aba0bd..aeec6b6 100644 --- a/Sources/TableKit.swift +++ b/Sources/TableKit.swift @@ -37,14 +37,8 @@ public protocol RowConfigurable { } public protocol RowActionable { - - @available(iOS 11, *) var leadingContextualActions: [UIContextualAction] { get } - - @available(iOS 11, *) var trailingContextualActions: [UIContextualAction] { get } - - @available(iOS 11, *) var performsFirstActionWithFullSwipe: Bool { get } @available(iOS, deprecated: 11, message: "Use leadingContextualActions, trailingContextualActions instead") diff --git a/Sources/TableRow.swift b/Sources/TableRow.swift index 6679595..211e6c0 100644 --- a/Sources/TableRow.swift +++ b/Sources/TableRow.swift @@ -27,18 +27,15 @@ open class TableRow: Row where CellType: UITableView @available(iOS, deprecated: 11, message: "Use leadingContextualActions, trailingContextualActions instead") open private(set) var editingActions: [UITableViewRowAction]? - - @available(iOS 11, *) + open var leadingContextualActions: [UIContextualAction] { [] } - - @available(iOS 11, *) + open var trailingContextualActions: [UIContextualAction] { [] } - - @available(iOS 11, *) + open var performsFirstActionWithFullSwipe: Bool { false } @@ -78,7 +75,6 @@ open class TableRow: Row where CellType: UITableView actions?.forEach { on($0) } } - @available(iOS 11, *) public init(item: CellType.CellData, actions: [TableRowAction]? = nil) { diff --git a/TableKit.podspec b/TableKit.podspec index 2db6237..a3bee68 100644 --- a/TableKit.podspec +++ b/TableKit.podspec @@ -2,15 +2,15 @@ Pod::Spec.new do |s| s.name = 'TableKit' s.module_name = 'TableKit' - s.version = '2.11.0' + s.version = '2.11.1' s.homepage = 'https://github.com/maxsokolov/TableKit' s.summary = 'Type-safe declarative table views with Swift.' s.author = { 'Max Sokolov' => 'i@maxsokolov.net' } s.license = { :type => 'MIT', :file => 'LICENSE' } - s.platforms = { :ios => '8.0' } - s.ios.deployment_target = '8.0' + s.platforms = { :ios => '12.0' } + s.ios.deployment_target = '12.0' s.source_files = 'Sources/*.swift' s.source = { :git => 'https://github.com/maxsokolov/TableKit.git', :tag => s.version }