Skip to content

Commit e132707

Browse files
committed
Add all of the remaining UITableViewDataSource methods to the TableViewDiffableDataSource
1 parent 1d6674c commit e132707

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

Sources/UIKit/TableViewDiffableDataSource.swift

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,56 @@ open class TableViewDiffableDataSource<SectionIdentifierType: Hashable, ItemIden
135135

136136
return cell
137137
}
138+
139+
/// Returns whether it is possible to edit a row at given index path.
140+
///
141+
/// - Parameters:
142+
/// - tableView: A table view instance managed by `self`.
143+
/// - section: An index of section.
144+
///
145+
/// - Returns: A boolean for row at specified index path.
146+
open func tableView(_ tableView: UITableView, canEditRowAt: IndexPath) -> Bool {
147+
return false
148+
}
149+
150+
/// Returns whether it is possible to move a row at given index path.
151+
///
152+
/// - Parameters:
153+
/// - tableView: A table view instance managed by `self`.
154+
/// - section: An index of section.
155+
///
156+
/// - Returns: A boolean for row at specified index path.
157+
open func tableView(_ tableView: UITableView, canMoveRowAt _: IndexPath) -> Bool {
158+
return false
159+
}
160+
161+
/// Performs the edit action for a row at given index path.
162+
///
163+
/// - Parameters:
164+
/// - tableView: A table view instance managed by `self`.
165+
/// - editingStyle: An action for given edit action.
166+
/// - indexPath: An index path for cell.
167+
///
168+
/// - Returns: Void.
169+
open func tableView(_ tableView: UITableView, commit _: UITableViewCell.EditingStyle, forRowAt _: IndexPath) {
170+
// Empty implementation.
171+
}
172+
173+
/// Moves a row at given index path.
174+
///
175+
/// - Parameters:
176+
/// - tableView: A table view instance managed by `self`.
177+
/// - source: An index path for given cell position.
178+
/// - target: An index path for target cell position.
179+
///
180+
/// - Returns: Void.
181+
open func tableView(_ tableView: UITableView, moveRowAt _: IndexPath, to _: IndexPath) {
182+
// Empty implementation.
183+
}
184+
185+
open func tableView(_ tableView: UITableView, sectionForSectionIndexTitle _: String, at section: Int) -> Int {
186+
return section
187+
}
138188
}
139189

140190
#endif

0 commit comments

Comments
 (0)