Skip to content

Commit fe5dcd5

Browse files
committed
Added more to table diffable delegate.
1 parent d371361 commit fe5dcd5

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

SPDiffable.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'SPDiffable'
4-
s.version = '4.0.9'
4+
s.version = '4.1.0'
55
s.summary = 'Extension of Diffable API which allow not duplicate code and use less models. Included example for SideBar.'
66
s.homepage = 'https://github.com/ivanvorobei/SPDiffable'
77
s.source = { :git => 'https://github.com/ivanvorobei/SPDiffable.git', :tag => s.version }

Sources/SPDiffable/Table/DataSource/SPDiffableTableDataSource+UITableViewDelegate.swift

+10
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ extension SPDiffableTableDataSource: UITableViewDelegate {
3636
}
3737
}
3838

39+
public func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
40+
guard let item = getItem(indexPath: indexPath) else { return nil }
41+
return diffableDelegate?.diffableTableView?(tableView, leadingSwipeActionsConfigurationForItem: item, at: indexPath)
42+
}
43+
44+
public func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
45+
guard let item = getItem(indexPath: indexPath) else { return nil }
46+
return diffableDelegate?.diffableTableView?(tableView, trailingSwipeActionsConfigurationForItem: item, at: indexPath)
47+
}
48+
3949
open func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
4050
guard let item = self.getSection(index: section)?.header else { return nil }
4151
for provider in headerFooterProviders {

Sources/SPDiffable/Table/Protocols/SPDiffableTableDelegate.swift

+4
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ import UIKit
2525
@objc public protocol SPDiffableTableDelegate: AnyObject {
2626

2727
@objc optional func diffableTableView(_ tableView: UITableView, didSelectItem item: SPDiffableItem, indexPath: IndexPath)
28+
29+
@objc optional func diffableTableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForItem item: SPDiffableItem, at indexPath: IndexPath) -> UISwipeActionsConfiguration?
30+
31+
@objc optional func diffableTableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForItem item: SPDiffableItem, at indexPath: IndexPath) -> UISwipeActionsConfiguration?
2832
}

0 commit comments

Comments
 (0)