File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
{{cookiecutter.app_name}}/Features/Sources/Counter Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ public struct Counter: FeatureReducer {
23
23
public enum ViewAction : Equatable {
24
24
case decrementButtonTapped
25
25
case incrementButtonTapped
26
+ case closeButtonTapped
27
+ }
28
+
29
+ public enum InternalAction : Equatable {
30
+ case close
26
31
}
27
32
28
33
public enum DelegateAction : Equatable {
@@ -38,6 +43,16 @@ public struct Counter: FeatureReducer {
38
43
case . incrementButtonTapped:
39
44
state. count += 1
40
45
return . none
46
+
47
+ case . closeButtonTapped:
48
+ return . send( . internal( . close) )
49
+ }
50
+ }
51
+
52
+ public func reduce( into state: inout State , internalAction: InternalAction ) -> Effect < Action > {
53
+ switch internalAction {
54
+ case . close:
55
+ return . send( . delegate( . close) )
41
56
}
42
57
}
43
58
}
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public struct CounterView: View {
39
39
}
40
40
41
41
Button {
42
- viewstore. send ( . delegate ( . close ) )
42
+ viewstore. send ( . view ( . closeButtonTapped ) )
43
43
} label: {
44
44
Text ( " Dismiss " )
45
45
. foregroundStyle ( . white)
You can’t perform that action at this time.
0 commit comments