Closed bobek-balinek closed 4 years ago
You can override canEditRowAt
, canMoveRowAt
, etc by adding @objc
annotation:
@objc(tableView:canEditRowAtIndexPath:)
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
true
}
FMI see Stack Overflow Swift 3 ObjC Optional Protocol Method Not Called in Subclass.
@bobek-balinek
Sorry for my late reply. I’m a bit busy lately, so please feel free to make a pull request!
Until fixed, please do a good workaround by @tako3 .
Thank you for creating this project, it's become really useful in few of my projects!
However I have noticed few methods from the official
UITableViewDiffableDataSource
are missing from your implementation:func tableView(UITableView, canEditRowAt: IndexPath) -> Bool
func tableView(UITableView, canMoveRowAt: IndexPath) -> Bool
func tableView(UITableView, cellForRowAt: IndexPath) -> UITableViewCell
func tableView(UITableView, commit: UITableViewCell.EditingStyle, forRowAt: IndexPath)
func tableView(UITableView, moveRowAt: IndexPath, to: IndexPath)
Reference: https://developer.apple.com/documentation/uikit/uitableviewdiffabledatasource
Naturally I'd expect these methods to be
open
and overridable to be able to construct and apply a new snapshot separately.Expected Behavior
Subclassing the
TableViewDiffableDataSource
should allow to override and provide a custom implementation forcanEditRowAt/canMoveRowAt
protocol methods.Current Behavior
Methods
canEditRowAt
andcommit:editingStyle:forRowAt
do not get executed when implemented on a subclass. This is probably because the base class does not provide anopen/public
default implementations for these.