Skip to content

Commit 8110a5f

Browse files
committed
Add new mathod to table mediator
1 parent eb09652 commit 8110a5f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Source/SPDiffable/Table/SPTableDiffableDataSource.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ open class SPTableDiffableDataSource: UITableViewDiffableDataSource<SPDiffableSe
4646
apply(snapshot, animatingDifferences: animating)
4747
}
4848

49+
// MARK: Mediator Calling
50+
4951
public override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
5052
if let title = mediator?.tableView?(tableView, titleForHeaderInSection: section) {
5153
return title
@@ -69,6 +71,10 @@ open class SPTableDiffableDataSource: UITableViewDiffableDataSource<SPDiffableSe
6971
public override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
7072
return mediator?.tableView?(tableView, canEditRowAt: indexPath) ?? false
7173
}
74+
75+
public override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
76+
mediator?.tableView?(tableView, commit: editingStyle, forRowAt: indexPath)
77+
}
7278
}
7379

7480
/**

Source/SPDiffable/Table/SPTableDiffableMediator.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ import UIKit
2828
@objc optional func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
2929

3030
@objc optional func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String?
31+
32+
@objc optional func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath)
3133
}

0 commit comments

Comments
 (0)