Skip to content

Commit 837688f

Browse files
committed
Change protocol to optional
1 parent baea234 commit 837688f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Source/SPDiffable/Table/SPTableDiffableDataSource.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ open class SPTableDiffableDataSource: UITableViewDiffableDataSource<SPDiffableSe
4747
}
4848

4949
public override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
50-
if let title = diffableDelegate?.tableView(tableView, titleForHeaderInSection: section) {
50+
if let title = diffableDelegate?.tableView?(tableView, titleForHeaderInSection: section) {
5151
return title
5252
}
5353
if let header = snapshot().sectionIdentifiers[section].header as? SPDiffableTextHeader {
@@ -57,7 +57,7 @@ open class SPTableDiffableDataSource: UITableViewDiffableDataSource<SPDiffableSe
5757
}
5858

5959
public override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
60-
if let title = diffableDelegate?.tableView(tableView, titleForFooterInSection: section) {
60+
if let title = diffableDelegate?.tableView?(tableView, titleForFooterInSection: section) {
6161
return title
6262
}
6363
if let footer = snapshot().sectionIdentifiers[section].footer as? SPDiffableTextFooter {
@@ -67,7 +67,7 @@ open class SPTableDiffableDataSource: UITableViewDiffableDataSource<SPDiffableSe
6767
}
6868

6969
public override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
70-
return diffableDelegate?.tableView(tableView, canEditRowAt: indexPath) ?? false
70+
return diffableDelegate?.tableView?(tableView, canEditRowAt: indexPath) ?? false
7171
}
7272
}
7373

Source/SPDiffable/Table/SPTableDiffableDelegate.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
import UIKit
2323

24-
public protocol SPTableDiffableDelegate: class {
24+
@objc public protocol SPTableDiffableDelegate: class {
2525

26-
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool
26+
@objc optional func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool
2727

28-
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
28+
@objc optional func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
2929

30-
func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String?
30+
@objc optional func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String?
3131
}

0 commit comments

Comments
 (0)