Skip to content

Commit

Permalink
Fix Tutorials Code Diff (#2427)
Browse files Browse the repository at this point in the history
  • Loading branch information
denil-ct authored Sep 3, 2023
1 parent 76f4326 commit 9bc00c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
will send a `factButtonTapped` action, which does not yet exist in the counter domain, but
will soon.

@Code(name: "CounterFeature.swift", file: 01-02-01-code-0001.swift, previousFile: 02-01-code-0001-previous.swift) {
@Code(name: "CounterFeature.swift", file: 01-02-01-code-0001.swift, previousFile: 01-02-01-code-0001-previous.swift) {
@Image(source: "02-01-image-0001")
}
}
Expand Down Expand Up @@ -111,7 +111,7 @@
you with an asynchronous context to perform any kind of work you want, as well as a handle
(`send`) for sending actions back into the system.

@Code(name: "CounterFeature.swift", file: 01-02-02-code-0001.swift, previousFile: 02-01-code-0005.swift)
@Code(name: "CounterFeature.swift", file: 01-02-02-code-0001.swift, previousFile: 01-02-01-code-0005.swift)
}

@Step {
Expand Down Expand Up @@ -181,7 +181,7 @@
> Note: The `isTimerRunning` state and `toggleTimerButtonTapped` actions do not yet exist.
> We will add them in the next step.

@Code(name: "CounterFeature.swift", file: 01-02-03-code-0001.swift, previousFile: 02-01-code-0002.swift)
@Code(name: "CounterFeature.swift", file: 01-02-03-code-0001.swift, previousFile: 01-02-01-code-0002.swift)
}

@Step {
Expand All @@ -190,7 +190,7 @@
action. We know we will want to execute some asynchronous work, in particular a timer, so
we have gone ahead and opened up a `run` effect.

@Code(name: "CounterFeature.swift", file: 01-02-03-code-0002.swift, previousFile: 02-02-code-0005.swift)
@Code(name: "CounterFeature.swift", file: 01-02-03-code-0002.swift, previousFile: 01-02-02-code-0005.swift)
}

@Step {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
Let's get the scaffolding of a new test into place by creating a new async test method
and constructing a ``ComposableArchitecture/TestStore``.

@Code(name: "CounterFeatureTests.swift", file: 01-03-02-code-0001.swift, previousFile: 03-02-code-0001-previous.swift)
@Code(name: "CounterFeatureTests.swift", file: 01-03-02-code-0001.swift, previousFile: 01-03-02-code-0001-previous.swift)
}

@Step {
Expand Down Expand Up @@ -202,7 +202,7 @@
And then, in the implementation of `reduce`, do not reach out to `Task.sleep` and instead
use the `clock` the feature depends on.

@Code(name: "CounterFeature.swift", file: 01-03-02-code-0008.swift, previousFile: 02-03-code-0006.swift)
@Code(name: "CounterFeature.swift", file: 01-03-02-code-0008.swift, previousFile: 01-02-03-code-0006.swift)
}

With that little bit of upfront work to control the dependency on time-based asynchrony
Expand Down Expand Up @@ -258,7 +258,7 @@
Also go ahead and get some scaffolding into place for the
``ComposableArchitecture/TestStore``.

@Code(name: "CounterFeatureTests.swift", file: 01-03-03-code-0001.swift, previousFile: 03-03-code-0001-previous.swift)
@Code(name: "CounterFeatureTests.swift", file: 01-03-03-code-0001.swift, previousFile: 01-03-03-code-0001-previous.swift)
}

For the test we want to emulate the flow of the user tapping the fact button, seeing the
Expand Down Expand Up @@ -378,7 +378,7 @@
`factButtonTapped`, use the `numberFact` dependency to load the fact rather than reaching
out to `URLSession` to make a live network request.

@Code(name: "CounterFeature.swift", file: 01-03-04-code-0005.swift, previousFile: 03-02-code-0008.swift)
@Code(name: "CounterFeature.swift", file: 01-03-04-code-0005.swift, previousFile: 01-03-02-code-0008.swift)
}

With that little bit of work done in the feature you can now instantly and easily write a
Expand All @@ -389,7 +389,7 @@
@Step {
Without making any changes to the test, run the test in Xcode again.

@Code(name: "CounterFeatureTests.swift", file: 01-03-04-code-0006.swift, previousFile: 03-04-code-0006-previous.swift)
@Code(name: "CounterFeatureTests.swift", file: 01-03-04-code-0006.swift, previousFile: 01-03-04-code-0006-previous.swift)
}

The test fails with the same messages, but there is a new one. It tells us that we are using
Expand Down

0 comments on commit 9bc00c5

Please sign in to comment.