Skip to content

Commit 1590846

Browse files
committed
Fix tutorial
1 parent b65b82b commit 1590846

File tree

5 files changed

+13
-124
lines changed

5 files changed

+13
-124
lines changed

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/02-MultipleDestinations/02-02-02-code-0015.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ struct ContactsView: View {
4242
}
4343
.alert(
4444
store: self.store.scope(
45-
state: \.$destination.alert,
46-
action: \.destination.alert
45+
state: \.$alert,
46+
action: \.alert
4747
)
4848
)
4949
}

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/02-MultipleDestinations/02-02-02-code-0016.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,20 @@ struct ContactsView: View {
3131
}
3232
}
3333
.sheet(
34-
store: self.store.scope(state: \.$destination, action: { .destination($0) }),
35-
state: \.addContact,
36-
action:
34+
store: self.store.scope(
35+
state: \.$destination.addContact,
36+
action: \.destination.addContact
37+
)
3738
) { addContactStore in
3839
NavigationStack {
3940
AddContactView(store: addContactStore)
4041
}
4142
}
4243
.alert(
43-
store: self.store.scope(state: \.$destination, action: { .destination($0) }),
44-
state: ,
45-
action:
44+
store: self.store.scope(
45+
state: \.$destination.alert,
46+
action: \.destination.alert
47+
)
4648
)
4749
}
4850
}

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/02-MultipleDestinations/02-02-02-code-0017.swift

Lines changed: 0 additions & 48 deletions
This file was deleted.

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/02-MultipleDestinations/02-02-02-code-0018.swift

Lines changed: 0 additions & 48 deletions
This file was deleted.

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/02-MultipleDestinations/02-02-MultipleDestinations.tutorial

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -241,30 +241,13 @@
241241

242242
@Code(name: "ContactsFeatures.swift", file: 02-02-02-code-0015, previousFile: 02-02-02-code-0015-previous)
243243
}
244-
245-
@Step {
246-
The state transformation is responsible for taking a piece of `Destination.State`, which
247-
is an enum, and extracting a particular case from it. This can be done with familiar key
248-
path syntax because the ``ComposableArchitecture/Reducer()`` macro applies the
249-
`@CasePathable` macro and `@dynamicMemberLookup` to the destination's `State` enum.
250-
251-
@Code(name: "ContactsFeatures.swift", file: 02-02-02-code-0016)
252-
}
253-
254-
@Step {
255-
The action transformation is responsible for taking a child action in the
256-
`AddContactFeature` domain and embedding it into the `Destination.Action` enum. This can
257-
be done by providing a closure to embed the child action into the destination's action.
258-
259-
@Code(name: "ContactsFeatures.swift", file: 02-02-02-code-0017)
260-
}
261-
244+
262245
@Step {
263246
The same can be done for the `alert(store:)` view modifier.
264247

265-
@Code(name: "ContactsFeatures.swift", file: 02-02-02-code-0018)
248+
@Code(name: "ContactsFeatures.swift", file: 02-02-02-code-0016)
266249
}
267-
250+
268251
That completes the refactor of the reducer and view to use a single piece of optional enum
269252
state instead using multiple optional values. The application works exactly as it did before,
270253
but now its domain is more concisely modeled.

0 commit comments

Comments
 (0)