@@ -2,9 +2,17 @@ import CasePaths
2
2
import Combine
3
3
import ComposableArchitecture
4
4
import SwiftUI
5
- import TuistComposableArchitectureSupport
5
+ import ComposableTuistArchitectureSupport
6
6
7
7
public struct RecipeListState {
8
+ public init (
9
+ recipes: [ Recipe ] = [ ] ,
10
+ isLoadingRecipes: Bool = false
11
+ ) {
12
+ self . recipes = recipes
13
+ self . isLoadingRecipes = isLoadingRecipes
14
+ }
15
+
8
16
var recipes : [ Recipe ] = [ ]
9
17
var isLoadingRecipes : Bool = false
10
18
}
@@ -15,11 +23,19 @@ public enum RecipeListAction: Equatable {
15
23
}
16
24
17
25
public struct RecipeListEnvironment {
26
+ public init (
27
+ cookbookClient: CookbookClient ,
28
+ mainQueue: AnySchedulerOf < DispatchQueue >
29
+ ) {
30
+ self . cookbookClient = cookbookClient
31
+ self . mainQueue = mainQueue
32
+ }
33
+
18
34
let cookbookClient : CookbookClient
19
35
let mainQueue : AnySchedulerOf < DispatchQueue >
20
36
}
21
37
22
- let recipeListReducer = Reducer < RecipeListState , RecipeListAction , RecipeListEnvironment > { state, action, environment in
38
+ public let recipeListReducer = Reducer < RecipeListState , RecipeListAction , RecipeListEnvironment > { state, action, environment in
23
39
switch action {
24
40
case . recipes:
25
41
state. isLoadingRecipes = true
@@ -54,6 +70,10 @@ public struct RecipeListView: View {
54
70
55
71
let store : Store < RecipeListState , RecipeListAction >
56
72
73
+ public init ( store: Store < RecipeListState , RecipeListAction > ) {
74
+ self . store = store
75
+ }
76
+
57
77
public var body : some View {
58
78
WithViewStore (
59
79
self . store. scope ( state: State . init, action: RecipeListAction . init)
0 commit comments