mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-24 12:14:25 +01:00
Fix "Composing features" tutorial (#2698)
* Fix the filename * Add `@MainActor` and `async` for testing the feature --------- Co-authored-by: Stephen Celis <stephen@stephencelis.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import ComposableArchitecture
|
||||
import XCTest
|
||||
|
||||
class AppFeatureTests: XCTestCase {
|
||||
func testIncrementInFirstTab() {
|
||||
@MainActor
|
||||
final class AppFeatureTests: XCTestCase {
|
||||
func testIncrementInFirstTab() async {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import ComposableArchitecture
|
||||
import XCTest
|
||||
|
||||
class AppFeatureTests: XCTestCase {
|
||||
func testIncrementInFirstTab() {
|
||||
@MainActor
|
||||
final class AppFeatureTests: XCTestCase {
|
||||
func testIncrementInFirstTab() async {
|
||||
let store = TestStore(initialState: AppFeature.State()) {
|
||||
AppFeature()
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import ComposableArchitecture
|
||||
import XCTest
|
||||
|
||||
class AppFeatureTests: XCTestCase {
|
||||
func testIncrementInFirstTab() {
|
||||
@MainActor
|
||||
final class AppFeatureTests: XCTestCase {
|
||||
func testIncrementInFirstTab() async {
|
||||
let store = TestStore(initialState: AppFeature.State()) {
|
||||
AppFeature()
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import ComposableArchitecture
|
||||
import XCTest
|
||||
|
||||
class AppFeatureTests: XCTestCase {
|
||||
func testIncrementInFirstTab() {
|
||||
@MainActor
|
||||
final class AppFeatureTests: XCTestCase {
|
||||
func testIncrementInFirstTab() async {
|
||||
let store = TestStore(initialState: AppFeature.State()) {
|
||||
AppFeature()
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
@Step {
|
||||
Replace the two individual store properties with a single store of the `AppFeature` domain.
|
||||
|
||||
@Code(name: "AppFeatureTests.swift", file: 01-04-03-code-0001.swift, previousFile: 01-04-03-code-0001-previous.swift)
|
||||
@Code(name: "AppFeature.swift", file: 01-04-03-code-0001.swift, previousFile: 01-04-03-code-0001-previous.swift)
|
||||
}
|
||||
|
||||
@Step {
|
||||
@@ -196,13 +196,13 @@
|
||||
domain. This is done by using key path syntax to single out the field of the state and
|
||||
the case of the action enum.
|
||||
|
||||
@Code(name: "AppFeatureTests.swift", file: 01-04-03-code-0002.swift)
|
||||
@Code(name: "AppFeature.swift", file: 01-04-03-code-0002.swift)
|
||||
}
|
||||
|
||||
@Step {
|
||||
And do the same for the second tab.
|
||||
|
||||
@Code(name: "AppFeatureTests.swift", file: 01-04-03-code-0003.swift)
|
||||
@Code(name: "AppFeature.swift", file: 01-04-03-code-0003.swift)
|
||||
}
|
||||
|
||||
That is all it takes. We now have a single ``ComposableArchitecture/Store`` powering this
|
||||
@@ -212,7 +212,7 @@
|
||||
@Step {
|
||||
Create a preview for `AppView` by initializing a store with the `AppFeature` domain.
|
||||
|
||||
@Code(name: "AppFeatureTests.swift", file: 01-04-03-code-0004.swift)
|
||||
@Code(name: "AppFeature.swift", file: 01-04-03-code-0004.swift)
|
||||
}
|
||||
|
||||
We can also run the feature in the simulator by updating the entry point of the app to be
|
||||
|
||||
Reference in New Issue
Block a user