Skip to content

Commit 3395a96

Browse files
Meet The Composable Architecture tutorial various fixes and improvements (#3568)
* Fix tutorial documentation typo: sync ups to contacts * Update tutorial documentation: Use .foregroundStyle for icon color to replace deprecated .foregroundColor * Update tutorial documentation: Clarify that Reducer() is a macro * Update tutorial documentation: Modify test code to use `.modify` for enum mutation to fix issue reported in #3158 * Update tutorial documentation: Add @CasePathable to Alert enum and simplify test case syntax * Add @CasePathable to Alert enum in tutorial documentation to be consistent with previous part of the tutorial * Update tutorial documentation: Simplify StackAction with StackActionOf typealias * Update Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/04-NavigationStacks/02-04-NavigationStacks.tutorial --------- Co-authored-by: Stephen Celis <[email protected]>
1 parent 1599296 commit 3395a96

21 files changed

+36
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/*.swiftinterface
66
/*.xcodeproj
77
xcuserdata/
8+
.docc-build/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258

259259
> Important: Delegate actions are the most general way of communicating from the child domain
260260
back to the parent, but there are other techniques. We could have also utilized the
261-
`@Shared` property wrapper for the collection of sync ups, which would allow the
261+
`@Shared` property wrapper for the collection of contacts, which would allow the
262262
`AddContactFeature` to insert a new contact directly into the parent collection without any
263263
further steps. This can be powerful, but we will use delegate actions for this tutorial. To
264264
read more about `@Shared` see the <doc:SharingState> article, and see the

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct ContactsView: View {
1212
store.send(.deleteButtonTapped(id: contact.id))
1313
} label: {
1414
Image(systemName: "trash")
15-
.foregroundColor(.red)
15+
.foregroundStyle(.red)
1616
}
1717
}
1818
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
@Step {
132132
Add a case for for the "Add contact" feature. Note that we are holding onto the actual
133133
`AddContactFeature` reducer in the case, not the state. The
134-
``ComposableArchitecture/Reducer()`` will fill in all the requirements for the reducer
134+
``ComposableArchitecture/Reducer()`` macro will fill in all the requirements for the reducer
135135
protocol for us automatically.
136136

137137
@Code(name: "ContactsFeatures.swift", file: 02-02-02-code-0001.swift)

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/03-TestingPresentation/02-03-01-code-0011.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct ContactsFeatureTests {
2222
)
2323
}
2424
await store.send(\.destination.addContact.setName, "Blob Jr.") {
25-
$0.destination?.addContact?.contact.name = "Blob Jr."
25+
$0.destination?.modify(\.addContact) { $0.contact.name = "Blob Jr." }
2626
}
2727
}
2828
}

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/03-TestingPresentation/02-03-01-code-0012.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct ContactsFeatureTests {
2222
)
2323
}
2424
await store.send(\.destination.addContact.setName, "Blob Jr.") {
25-
$0.destination?.addContact?.contact.name = "Blob Jr."
25+
$0.destination?.modify(\.addContact) { $0.contact.name = "Blob Jr." }
2626
}
2727
await store.send(\.destination.addContact.saveButtonTapped)
2828
}

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/03-TestingPresentation/02-03-01-code-0013.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct ContactsFeatureTests {
2222
)
2323
}
2424
await store.send(\.destination.addContact.setName, "Blob Jr.") {
25-
$0.destination?.addContact?.contact.name = "Blob Jr."
25+
$0.destination?.modify(\.addContact) { $0.contact.name = "Blob Jr." }
2626
}
2727
await store.send(\.destination.addContact.saveButtonTapped)
2828
await store.receive(

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/03-TestingPresentation/02-03-01-code-0014.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct ContactsFeatureTests {
2222
)
2323
}
2424
await store.send(\.destination.addContact.setName, "Blob Jr.") {
25-
$0.destination?.addContact?.contact.name = "Blob Jr."
25+
$0.destination?.modify(\.addContact) { $0.contact.name = "Blob Jr." }
2626
}
2727
await store.send(\.destination.addContact.saveButtonTapped)
2828
await store.receive(

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/03-TestingPresentation/02-03-01-code-0016.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct ContactsFeatureTests {
2222
)
2323
}
2424
await store.send(\.destination.addContact.setName, "Blob Jr.") {
25-
$0.destination?.addContact?.contact.name = "Blob Jr."
25+
$0.destination?.modify(\.addContact) { $0.contact.name = "Blob Jr." }
2626
}
2727
await store.send(\.destination.addContact.saveButtonTapped)
2828
await store.receive(

Sources/ComposableArchitecture/Documentation.docc/Tutorials/MeetTheComposableArchitecture/02-Navigation/03-TestingPresentation/02-03-01-code-0017.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct ContactsFeatureTests {
2222
)
2323
}
2424
await store.send(\.destination.addContact.setName, "Blob Jr.") {
25-
$0.destination?.addContact?.contact.name = "Blob Jr."
25+
$0.destination?.modify(\.addContact) { $0.contact.name = "Blob Jr." }
2626
}
2727
await store.send(\.destination.addContact.saveButtonTapped)
2828
await store.receive(

0 commit comments

Comments
 (0)