File tree Expand file tree Collapse file tree 1 file changed +9
-22
lines changed
Sources/ComposableArchitecture/UIKit Expand file tree Collapse file tree 1 file changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -48,29 +48,16 @@ extension Store {
48
48
then unwrap: @escaping ( Store < Wrapped , Action > ) -> Void ,
49
49
else: @escaping ( ) -> Void = { }
50
50
) -> Disposable where State == Wrapped ? {
51
- let elseDisposable =
52
- self
53
- . producerScope (
54
- state: { state -> Effect < Wrapped ? , Never > in
55
- state
56
- . skipRepeats { ( $0 != nil ) == ( $1 != nil ) }
51
+ return self . producer. skipRepeats ( { ( $0 != nil ) == ( $1 != nil ) } )
52
+ . startWithValues { state in
53
+ if var state = state {
54
+ unwrap ( self . scope {
55
+ state = $0 ?? state
56
+ return state
57
+ } )
58
+ } else {
59
+ `else` ( )
57
60
}
58
- )
59
- . startWithValues { store in
60
- if store. state == nil { `else` ( ) }
61
61
}
62
-
63
- let unwrapDisposable =
64
- self
65
- . producerScope (
66
- state: { state -> Effect < Wrapped , Never > in
67
- state
68
- . skipRepeats { ( $0 != nil ) == ( $1 != nil ) }
69
- . compactMap { $0 }
70
- }
71
- )
72
- . startWithValues ( unwrap)
73
-
74
- return CompositeDisposable ( [ elseDisposable, unwrapDisposable] )
75
62
}
76
63
}
You can’t perform that action at this time.
0 commit comments