@@ -12,28 +12,30 @@ import XCTestDynamicOverlay
12
12
13
13
// NB: Deprecated after 0.39.0:
14
14
15
- extension CaseLet {
16
- @available ( * , deprecated, renamed: " EnumState " )
17
- public typealias GlobalState = EnumState
15
+ #if canImport(SwiftUI)
16
+ extension CaseLet {
17
+ @available ( * , deprecated, renamed: " EnumState " )
18
+ public typealias GlobalState = EnumState
18
19
19
- @available ( * , deprecated, renamed: " EnumAction " )
20
- public typealias GlobalAction = EnumAction
20
+ @available ( * , deprecated, renamed: " EnumAction " )
21
+ public typealias GlobalAction = EnumAction
21
22
22
- @available ( * , deprecated, renamed: " CaseState " )
23
- public typealias LocalState = CaseState
23
+ @available ( * , deprecated, renamed: " CaseState " )
24
+ public typealias LocalState = CaseState
24
25
25
- @available ( * , deprecated, renamed: " CaseAction " )
26
- public typealias LocalAction = CaseAction
27
- }
26
+ @available ( * , deprecated, renamed: " CaseAction " )
27
+ public typealias LocalAction = CaseAction
28
+ }
29
+ #endif
28
30
29
31
#if DEBUG
30
- extension TestStore {
31
- @available ( * , deprecated, renamed: " ScopedState " )
32
- public typealias LocalState = ScopedState
32
+ extension TestStore {
33
+ @available ( * , deprecated, renamed: " ScopedState " )
34
+ public typealias LocalState = ScopedState
33
35
34
- @available ( * , deprecated, renamed: " ScopedAction " )
35
- public typealias LocalAction = ScopedAction
36
- }
36
+ @available ( * , deprecated, renamed: " ScopedAction " )
37
+ public typealias LocalAction = ScopedAction
38
+ }
37
39
#endif
38
40
39
41
// NB: Deprecated after 0.38.2:
@@ -42,8 +44,8 @@ extension Effect where Failure == Error {
42
44
@_disfavoredOverload
43
45
@available (
44
46
* ,
45
- deprecated,
46
- message: " Use the non-failing version of 'Effect.task' "
47
+ deprecated,
48
+ message: " Use the non-failing version of 'Effect.task' "
47
49
)
48
50
public static func task(
49
51
priority: TaskPriority ? = nil ,
@@ -82,8 +84,8 @@ extension Effect where Failure == Error {
82
84
/// - environment: The environment of dependencies for the application.
83
85
@available (
84
86
* ,
85
- deprecated,
86
- message:
87
+ deprecated,
88
+ message:
87
89
"""
88
90
If you use this initializer, please open a discussion on GitHub and let us know how: \
89
91
https://github.com/pointfreeco/swift-composable-architecture/discussions/new
@@ -131,8 +133,8 @@ extension ViewStore {
131
133
extension Effect {
132
134
@available (
133
135
* ,
134
- deprecated,
135
- message:
136
+ deprecated,
137
+ message:
136
138
"""
137
139
Using a variadic list is no longer supported. Use an array of identifiers instead. For more \
138
140
on this change, see: https://github.com/pointfreeco/swift-composable-architecture/pull/1041
@@ -149,8 +151,8 @@ extension Effect {
149
151
extension Reducer {
150
152
@available (
151
153
* ,
152
- deprecated,
153
- message: " 'pullback' no longer takes a 'breakpointOnNil' argument "
154
+ deprecated,
155
+ message: " 'pullback' no longer takes a 'breakpointOnNil' argument "
154
156
)
155
157
public func pullback< ParentState, ParentAction, ParentEnvironment> (
156
158
state toChildState: CasePath < ParentState , State > ,
@@ -171,8 +173,8 @@ extension Reducer {
171
173
172
174
@available (
173
175
* ,
174
- deprecated,
175
- message: " 'optional' no longer takes a 'breakpointOnNil' argument "
176
+ deprecated,
177
+ message: " 'optional' no longer takes a 'breakpointOnNil' argument "
176
178
)
177
179
public func optional(
178
180
breakpointOnNil: Bool ,
@@ -186,8 +188,8 @@ extension Reducer {
186
188
187
189
@available (
188
190
* ,
189
- deprecated,
190
- message: " 'forEach' no longer takes a 'breakpointOnNil' argument "
191
+ deprecated,
192
+ message: " 'forEach' no longer takes a 'breakpointOnNil' argument "
191
193
)
192
194
public func forEach< ParentState, ParentAction, ParentEnvironment, ID> (
193
195
state toElementsState: WritableKeyPath < ParentState , IdentifiedArray < ID , State > > ,
@@ -208,8 +210,8 @@ extension Reducer {
208
210
209
211
@available (
210
212
* ,
211
- deprecated,
212
- message: " 'forEach' no longer takes a 'breakpointOnNil' argument "
213
+ deprecated,
214
+ message: " 'forEach' no longer takes a 'breakpointOnNil' argument "
213
215
)
214
216
public func forEach< ParentState, ParentAction, ParentEnvironment, Key> (
215
217
state toElementsState: WritableKeyPath < ParentState , [ Key : State ] > ,
@@ -265,13 +267,13 @@ extension Reducer {
265
267
var actions = " "
266
268
customDump ( self . receivedActions. map ( \. action) , to: & actions)
267
269
XCTFail (
268
- """
269
- Must handle \( self . receivedActions. count) received \
270
- action \( self . receivedActions. count == 1 ? " " : " s " ) before performing this work: …
270
+ """
271
+ Must handle \( self . receivedActions. count) received \
272
+ action \( self . receivedActions. count == 1 ? " " : " s " ) before performing this work: …
271
273
272
- Unhandled actions: \( actions)
273
- """ ,
274
- file: step. file, line: step. line
274
+ Unhandled actions: \( actions)
275
+ """ ,
276
+ file: step. file, line: step. line
275
277
)
276
278
}
277
279
do {
@@ -285,13 +287,13 @@ extension Reducer {
285
287
var actions = " "
286
288
customDump ( self . receivedActions. map ( \. action) , to: & actions)
287
289
XCTFail (
288
- """
289
- Must handle \( self . receivedActions. count) received \
290
- action \( self . receivedActions. count == 1 ? " " : " s " ) before performing this work: …
290
+ """
291
+ Must handle \( self . receivedActions. count) received \
292
+ action \( self . receivedActions. count == 1 ? " " : " s " ) before performing this work: …
291
293
292
- Unhandled actions: \( actions)
293
- """ ,
294
- file: step. file, line: step. line
294
+ Unhandled actions: \( actions)
295
+ """ ,
296
+ file: step. file, line: step. line
295
297
)
296
298
}
297
299
do {
@@ -390,14 +392,14 @@ extension Reducer {
390
392
}
391
393
}
392
394
}
393
- #endif
395
+ #endif
394
396
395
- // NB: Deprecated after 0.27.1:
396
- #if canImport(SwiftUI)
397
+ // NB: Deprecated after 0.27.1:
398
+ #if canImport(SwiftUI)
397
399
extension AlertState . Button {
398
400
@available (
399
401
* , deprecated,
400
- message: " Cancel buttons must be given an explicit label as their first argument "
402
+ message: " Cancel buttons must be given an explicit label as their first argument "
401
403
)
402
404
public static func cancel( action: AlertState . ButtonAction ? = nil ) -> Self {
403
405
. init( action: action, label: TextState ( " Cancel " ) , role: . cancel)
@@ -428,14 +430,16 @@ extension Reducer {
428
430
extension Store {
429
431
@available (
430
432
* , deprecated,
431
- message:
433
+ message:
432
434
"""
433
435
If you use this method, please open a discussion on GitHub and let us know how: \
434
436
https://github.com/pointfreeco/swift-composable-architecture/discussions/new
435
437
"""
436
438
)
437
439
public func producerScope< ChildState, ChildAction> (
438
- state toChildState: @escaping ( SignalProducer < State , Never > ) -> SignalProducer < ChildState , Never > ,
440
+ state toChildState: @escaping ( SignalProducer < State , Never > ) -> SignalProducer <
441
+ ChildState , Never
442
+ > ,
439
443
action fromChildAction: @escaping ( ChildAction ) -> Action
440
444
) -> SignalProducer < Store < ChildState , ChildAction > , Never > {
441
445
@@ -472,14 +476,16 @@ extension Reducer {
472
476
473
477
@available (
474
478
* , deprecated,
475
- message:
479
+ message:
476
480
"""
477
481
If you use this method, please open a discussion on GitHub and let us know how: \
478
482
https://github.com/pointfreeco/swift-composable-architecture/discussions/new
479
483
"""
480
484
)
481
485
public func producerScope< ChildState> (
482
- state toChildState: @escaping ( SignalProducer < State , Never > ) -> SignalProducer < ChildState , Never >
486
+ state toChildState: @escaping ( SignalProducer < State , Never > ) -> SignalProducer <
487
+ ChildState , Never
488
+ >
483
489
) -> SignalProducer < Store < ChildState , Action > , Never > {
484
490
self . producerScope ( state: toChildState, action: { $0 } )
485
491
}
@@ -488,7 +494,7 @@ extension Reducer {
488
494
extension ViewStore where Action: BindableAction , Action. State == State {
489
495
@available (
490
496
* , deprecated,
491
- message:
497
+ message:
492
498
"""
493
499
Dynamic member lookup is no longer supported for bindable state. Instead of dot-chaining on \
494
500
the view store, e.g. 'viewStore.$value', invoke the 'binding' method on view store with a \
@@ -511,7 +517,7 @@ extension Reducer {
511
517
extension BindingAction {
512
518
@available (
513
519
* , deprecated,
514
- message:
520
+ message:
515
521
"""
516
522
For improved safety, bindable properties must now be wrapped explicitly in 'BindableState', \
517
523
and accessed via key paths to that 'BindableState', like ' \\ .$value'
@@ -531,7 +537,7 @@ extension Reducer {
531
537
532
538
@available (
533
539
* , deprecated,
534
- message:
540
+ message:
535
541
"""
536
542
For improved safety, bindable properties must now be wrapped explicitly in 'BindableState', \
537
543
and accessed via key paths to that 'BindableState', like ' \\ .$value'
@@ -548,14 +554,14 @@ extension Reducer {
548
554
extension Reducer {
549
555
@available (
550
556
* , deprecated,
551
- message:
557
+ message:
552
558
"""
553
559
'Reducer.binding()' no longer takes an explicit extract function and instead the reducer's \
554
560
'Action' type must conform to 'BindableAction'
555
561
"""
556
562
)
557
563
public func binding( action toBindingAction: @escaping ( Action ) -> BindingAction < State > ? )
558
- -> Self
564
+ -> Self
559
565
{
560
566
Self { state, action, environment in
561
567
toBindingAction ( action) ? . set ( & state)
@@ -565,27 +571,27 @@ extension Reducer {
565
571
}
566
572
567
573
#if canImport(SwiftUI)
568
- extension ViewStore {
569
- @available (
570
- * , deprecated,
571
- message:
572
- """
574
+ extension ViewStore {
575
+ @available (
576
+ * , deprecated,
577
+ message:
578
+ """
573
579
For improved safety, bindable properties must now be wrapped explicitly in 'BindableState'. \
574
580
Bindings are now derived via 'ViewStore.binding' with a key path to that 'BindableState' \
575
581
(for example, 'viewStore.binding( \\ .$value)'). For dynamic member lookup to be available, \
576
582
the view store's 'Action' type must also conform to 'BindableAction'.
577
583
"""
578
- )
579
- public func binding< Value: Equatable > (
580
- keyPath: WritableKeyPath < State , Value > ,
581
- send action: @escaping ( BindingAction < State > ) -> Action
582
- ) -> Binding < Value > {
583
- self . binding (
584
- get: { $0 [ keyPath: keyPath] } ,
585
- send: { action ( . set( keyPath, $0) ) }
586
584
)
585
+ public func binding< Value: Equatable > (
586
+ keyPath: WritableKeyPath < State , Value > ,
587
+ send action: @escaping ( BindingAction < State > ) -> Action
588
+ ) -> Binding < Value > {
589
+ self . binding (
590
+ get: { $0 [ keyPath: keyPath] } ,
591
+ send: { action ( . set( keyPath, $0) ) }
592
+ )
593
+ }
587
594
}
588
- }
589
595
#endif
590
596
591
597
// NB: Deprecated after 0.23.0:
@@ -700,10 +706,10 @@ extension Reducer {
700
706
@ViewBuilder content: @escaping ( Store < EachState , EachAction > ) -> EachContent
701
707
)
702
708
where
703
- Data == [ EachState ] ,
704
- Content == WithViewStore <
705
- [ ID ] , ( Data . Index , EachAction ) , ForEach < [ ( offset: Int , element: ID ) ] , ID , EachContent >
706
- >
709
+ Data == [ EachState ] ,
710
+ Content == WithViewStore <
711
+ [ ID ] , ( Data . Index , EachAction ) , ForEach < [ ( offset: Int , element: ID ) ] , ID , EachContent >
712
+ >
707
713
{
708
714
let data = store. state
709
715
self . data = data
@@ -727,12 +733,12 @@ extension Reducer {
727
733
@ViewBuilder content: @escaping ( Store < EachState , EachAction > ) -> EachContent
728
734
)
729
735
where
730
- Data == [ EachState ] ,
731
- Content == WithViewStore <
732
- [ ID ] , ( Data . Index , EachAction ) , ForEach < [ ( offset: Int , element: ID ) ] , ID , EachContent >
733
- > ,
734
- EachState: Identifiable ,
735
- EachState. ID == ID
736
+ Data == [ EachState ] ,
737
+ Content == WithViewStore <
738
+ [ ID ] , ( Data . Index , EachAction ) , ForEach < [ ( offset: Int , element: ID ) ] , ID , EachContent >
739
+ > ,
740
+ EachState: Identifiable ,
741
+ EachState. ID == ID
736
742
{
737
743
self . init ( store, id: \. id, content: content)
738
744
}
0 commit comments