Change to use deselect instead of selecting a nil indexPath since deselect still animates correctly on iOS 14.

This commit is contained in:
Maurice Parker 2020-10-22 19:48:09 -05:00
parent 18726d061d
commit 8cffd206ec
1 changed files with 10 additions and 6 deletions

View File

@ -40,15 +40,19 @@ class UpdateSelectionOperation: MainThreadOperation {
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animations: animations)
CATransaction.commit()
} else {
if let indexPath = tableView.indexPathForSelectedRow {
if animations.contains(.select) {
CATransaction.begin()
CATransaction.setCompletionBlock {
self.operationDelegate?.operationDidComplete(self)
}
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
tableView.deselectRow(at: indexPath, animated: true)
CATransaction.commit()
} else {
tableView.selectRow(at: nil, animated: false, scrollPosition: .none)
tableView.deselectRow(at: indexPath, animated: false)
self.operationDelegate?.operationDidComplete(self)
}
} else {
self.operationDelegate?.operationDidComplete(self)
}
}