File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Examples/CaseStudies/UIKitCaseStudies Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ let cellIdentifier = "Cell"
2525final class CountersTableViewController : UITableViewController {
2626 let store : StoreOf < CounterList >
2727
28+ var observations : [ IndexPath : ObservationToken ] = [ : ]
29+
2830 init ( store: StoreOf < CounterList > ) {
2931 self . store = store
3032 super. init ( nibName: nil , bundle: nil )
@@ -51,7 +53,8 @@ final class CountersTableViewController: UITableViewController {
5153 {
5254 let cell = tableView. dequeueReusableCell ( withIdentifier: cellIdentifier, for: indexPath)
5355 cell. accessoryType = . disclosureIndicator
54- observe { [ weak self] in
56+ observations [ indexPath] ? . cancel ( )
57+ observations [ indexPath] = observe { [ weak self] in
5558 guard let self else { return }
5659 cell. textLabel? . text = " \( store. counters [ indexPath. row] . count) "
5760 }
You can’t perform that action at this time.
0 commit comments