Skip to content

Commit fdb6fbe

Browse files
Fix typo in the "Meet the Composable Architecture" tutorial (#2114)
* Fix typo * Update Sources/ComposableArchitecture/Documentation.docc/Tutorials/01-YourFirstFeature.tutorial * Update Sources/ComposableArchitecture/Documentation.docc/Tutorials/03-TestingYourFeature.tutorial --------- Co-authored-by: Stephen Celis <[email protected]>
1 parent b017871 commit fdb6fbe

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

Sources/ComposableArchitecture/Documentation.docc/Tutorials/01-YourFirstFeature.tutorial

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
To conform to ``ComposableArchitecture/ReducerProtocol`` you will start with a domain
3737
modeling exercise. You will create a `State` type that holds the state your feature needs
3838
to do its job, typically a struct. Then you will create an `Action` type that holds all
39-
the actions the user can perform in the feature, typically an enum.
39+
the actions the user can perform in the feature, typically an enum.
4040

4141
@Code(name: "CounterFeature.swift", file: 01-01-code-0003.swift)
4242
}
@@ -74,7 +74,7 @@
7474
to the state's count. We must also return a value of ``ComposableArchitecture/EffectTask``
7575
that represents the effect to be executed in the outside world, but in this case we do not
7676
need to execute anything. So we can return a special
77-
``ComposableArchitecture/EffectPublisher/none`` value to represents we have no effects to
77+
``ComposableArchitecture/EffectPublisher/none`` value to represent we have no effects to
7878
execute.
7979

8080
@Code(name: "CounterFeature.swift", file: 01-01-code-0006.swift)
@@ -116,7 +116,7 @@
116116
}
117117

118118
@Step {
119-
Next we can implement some basic view heirarchy for displaying the count and providing
119+
Next, we can implement some basic view hierarchy for displaying the count and providing
120120
buttons for incrementing and decrementing.
121121

122122
> Note: You cannot read state from a ``ComposableArchitecture/Store`` directly, nor can you
@@ -134,7 +134,7 @@
134134
With some basic view scaffolding in place we can now start actually observing state in the
135135
`store`. This is done by constructing a ``ComposableArchitecture/ViewStore``, and for
136136
SwiftUI views there is a convenience view called a ``ComposableArchitecture/WithViewStore``
137-
that provides a lightweight syntax for construct a view store.
137+
that provides a lightweight syntax for constructing a view store.
138138

139139
@Step {
140140
View stores require that `State` be `Equatable`, so we must do that first. Once the view
@@ -164,7 +164,7 @@
164164
}
165165

166166
Before moving onto the next section, let's quickly show off a super power of the Composable
167-
Architecture. Because all of the feature's logic and behavior is contained in the reducer,
167+
Architecture. Because all of the feature's logic and behavior are contained in the reducer,
168168
we can run the preview with a completely different reducer to alter how it executes.
169169

170170
@Step {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/02-AddingSideEffects.tutorial

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
@ContentAndMedia {
99
Side effects are by far the most important aspect of feature development. They are what allow
1010
us to communicate with the outside world, such as making API requests, interacting with file
11-
systems, and performing time-based asynchrony. Without them our applications could not do
11+
systems, and performing time-based asynchrony. Without them, our applications could not do
1212
anything of real value for our users.
1313

1414
However, side effects are also the most complex part of our features. State mutations are
15-
simple processes. If you run the reducer with the same piece of state and same action you will
15+
simple processes. If you run the reducer with the same piece of state and same action, you will
1616
always get the same result. But effects are susceptible to the vagaries of the outside world,
17-
such as network connectivity, disk permissions, and more. Each time you run an effect you
17+
such as network connectivity, disk permissions, and more. Each time you run an effect, you
1818
can get back a completely different answer.
1919

2020
Let's start by seeing why we can't simply perform effectful work directly in our
@@ -42,7 +42,7 @@
4242
@Step {
4343
We will also add a progress view at the bottom to display while we are loading the fact,
4444
and we will unwrap a bit of optional state to display the fact. We are using the
45-
`isLoading` and `fact` state to accomplish this, neither of which exist in the counter
45+
`isLoading` and `fact` state to accomplish this, neither of which exists in the counter
4646
feature yet, but will soon.
4747

4848
@Code(name: "CounterFeature.swift", file: 02-01-code-0002.swift)
@@ -63,7 +63,7 @@
6363
Let's add the additional state and actions that have been dictated to us by the view.
6464
We know we need some `fact` and `isLoading` state, and we need a `factButtonTapped` action.
6565
We can also implement that action in the reducer by flipping `isLoading` to `true`, and
66-
we'll clear the `fact` state when any button is tapped. And finally we will return `.none`
66+
we'll clear the `fact` state when any button is tapped. And finally, we will return `.none`
6767
just like we did in all the other cases.
6868

6969
@Code(name: "CounterFeature.swift", file: 02-01-code-0004.swift)
@@ -82,7 +82,7 @@
8282

8383
The Composable Architecture separates the simple, pure transformations of state from the
8484
complex, messy side effects. It is one of the core tenets of the library and there are a lot
85-
of benefits to doing so. Luckily for us the library gives us a tool that is appropriate
85+
of benefits to doing so. Luckily for us, the library gives us a tool that is appropriate
8686
for executing side effects. It is called ``ComposableArchitecture/EffectTask`` and it is
8787
explored in the next section.
8888
}
@@ -214,7 +214,7 @@
214214
"Stop timer", we will see that the timer did not stop.
215215

216216
@Step {
217-
To fix the bug we can leverage a powerful feature of the Composable Architecture known as
217+
To fix the bug, we can leverage a powerful feature of the Composable Architecture known as
218218
"effect cancellation". We can mark any effect as cancellable using the
219219
``ComposableArchitecture/EffectPublisher/cancellable(id:cancelInFlight:)-29q60`` method
220220
by providing an ID, and then at a later time we can cancel that effect using

Sources/ComposableArchitecture/Documentation.docc/Tutorials/03-TestingYourFeature.tutorial

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@Tutorial(time: 60) {
22
@Intro(title: "Testing your feature") {
33
Learn how to write test for the counter built in previous tutorials, including how to assert
4-
against state changes and how effects execute and feed data back into the system.
4+
against state changes and how effects execute and feed data back into the system.
55
}
66

77
@Section(title: "Testing state changes") {
@@ -34,7 +34,7 @@
3434
}
3535

3636
@Step {
37-
Next we will create a ``ComposableArchitecture/TestStore``, which is a tool that makes it
37+
Next, we will create a ``ComposableArchitecture/TestStore``, which is a tool that makes it
3838
easy to assert on how the behavior of your feature changes as actions are sent into the
3939
system. You create a test store in the same way you create a
4040
``ComposableArchitecture/Store``, by providing some initial state to start the feature in
@@ -57,10 +57,10 @@
5757

5858
@Step {
5959
Run the test by typing cmd+U or clicking the test diamond next to the test method.
60-
Unfortunately you will find that the test fails. This is because each time you send an
60+
Unfortunately, you will find that the test fails. This is because each time you send an
6161
action to a ``ComposableArchitecture/TestStore`` you must also describe exactly how the
6262
state changes after that action is sent. The library also helpfully shows you a detailed
63-
failure message showing you exactly how state differed from what you expect (the lines
63+
failure message showing you exactly how state differed from what you expected (the lines
6464
with the minus "-") and the actual value (the lines with the plus "+").
6565

6666
@Code(name: "CounterFeatureTests.swift", file: 03-01-code-0004.swift)
@@ -96,7 +96,7 @@
9696
the effects it returns that are then processed by the store.
9797

9898
Writing tests against side effects takes a lot more work since you typically have to
99-
control you dependency on external systems and then provide test-friendly versions of those
99+
control your dependency on external systems and then provide test-friendly versions of those
100100
dependencies for tests. Let's start by testing the timer functionality of our feature,
101101
which turns out to be a little easier to test than the network request for fetching a number
102102
fact.
@@ -163,7 +163,7 @@
163163
@Step {
164164
Run tests to see that, unfortunately, the test fails. This is happening because our timer
165165
takes a full second to emit, but the test store will only wait around for a small amount
166-
of time to receive an action, and if it doesn't it creates a test failure. This is
166+
of time to receive an action, and if it doesn't, it creates a test failure. This is
167167
because the test store doesn't want your tests to be slow, and so rather you take control
168168
over your dependency on time to write a faster, more deterministic test.
169169

0 commit comments

Comments
 (0)