Skip to content

Commit a5bf50b

Browse files
committed
Fix the animated OptionRow deselection
1 parent 8a7e2e1 commit a5bf50b

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log
22

3+
## v1.1.1
4+
5+
#### Fixes
6+
7+
* Fix the animated `OptionRow` deselection
8+
* Invoke `accessoryButtonAction` asynchronously to match the behaviour of row `action`
9+
310
## v1.1.0
411

512
#### Enhancements

Example-iOS/ViewControllers/ExampleViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ internal final class ExampleViewController: QuickTableViewController {
122122
private func showDebuggingText(_ text: String) {
123123
print(text)
124124
debugging.rows = [NavigationRow(text: text, detailText: .none)]
125-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { [weak self] in
126-
self?.tableView.reloadData()
125+
if let section = tableContents.index(where: { $0 === debugging }) {
126+
tableView.reloadSections([section], with: .none)
127127
}
128128
}
129129

Source/QuickTableViewController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ open class QuickTableViewController: UIViewController, UITableViewDataSource, UI
133133
if changes.isEmpty {
134134
tableView.deselectRow(at: indexPath, animated: false)
135135
} else {
136-
tableView.reloadData()
136+
tableView.reloadRows(at: changes, with: .automatic)
137137
}
138138

139139
case let (_, option as OptionRowCompatible):
@@ -169,7 +169,9 @@ open class QuickTableViewController: UIViewController, UITableViewDataSource, UI
169169
public func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {
170170
switch tableContents[indexPath.section].rows[indexPath.row] {
171171
case let row as NavigationRowCompatible:
172-
row.accessoryButtonAction?(row)
172+
DispatchQueue.main.async {
173+
row.accessoryButtonAction?(row)
174+
}
173175
default:
174176
break
175177
}

0 commit comments

Comments
 (0)