Skip to content

Commit dd084dc

Browse files
Fix UIKitCaseStudies' List example (#984)
1 parent 8d89f7a commit dd084dc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Examples/CaseStudies/UIKitCaseStudies/CounterViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let counterReducer = Reducer<CounterState, CounterAction, CounterEnvironment> {
2828

2929
final class CounterViewController: UIViewController {
3030
let viewStore: ViewStore<CounterState, CounterAction>
31-
var cancellables: Set<AnyCancellable> = []
31+
private var cancellables: Set<AnyCancellable> = []
3232

3333
init(store: Store<CounterState, CounterAction>) {
3434
self.viewStore = ViewStore(store)

Examples/CaseStudies/UIKitCaseStudies/ListsOfState.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ final class CountersTableViewController: UITableViewController {
6363
}
6464

6565
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
66-
let counter = self.viewStore.counters[indexPath.row]
66+
let indexPathRow = indexPath.row
67+
let counter = self.viewStore.counters[indexPathRow]
6768
self.navigationController?.pushViewController(
6869
CounterViewController(
6970
store: self.store.scope(
70-
state: { _ in counter },
71+
state: \.counters[indexPathRow],
7172
action: { .counter(id: counter.id, action: $0) }
7273
)
7374
),

0 commit comments

Comments
 (0)