Skip to content

Commit

Permalink
Added more to table diffable delegate.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvorobei committed Mar 2, 2022
1 parent d371361 commit fe5dcd5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SPDiffable.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'SPDiffable'
s.version = '4.0.9'
s.version = '4.1.0'
s.summary = 'Extension of Diffable API which allow not duplicate code and use less models. Included example for SideBar.'
s.homepage = 'https://github.com/ivanvorobei/SPDiffable'
s.source = { :git => 'https://github.com/ivanvorobei/SPDiffable.git', :tag => s.version }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ extension SPDiffableTableDataSource: UITableViewDelegate {
}
}

public func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
guard let item = getItem(indexPath: indexPath) else { return nil }
return diffableDelegate?.diffableTableView?(tableView, leadingSwipeActionsConfigurationForItem: item, at: indexPath)
}

public func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
guard let item = getItem(indexPath: indexPath) else { return nil }
return diffableDelegate?.diffableTableView?(tableView, trailingSwipeActionsConfigurationForItem: item, at: indexPath)
}

open func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
guard let item = self.getSection(index: section)?.header else { return nil }
for provider in headerFooterProviders {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ import UIKit
@objc public protocol SPDiffableTableDelegate: AnyObject {

@objc optional func diffableTableView(_ tableView: UITableView, didSelectItem item: SPDiffableItem, indexPath: IndexPath)

@objc optional func diffableTableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForItem item: SPDiffableItem, at indexPath: IndexPath) -> UISwipeActionsConfiguration?

@objc optional func diffableTableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForItem item: SPDiffableItem, at indexPath: IndexPath) -> UISwipeActionsConfiguration?
}

0 comments on commit fe5dcd5

Please sign in to comment.