@@ -12,28 +12,30 @@ import XCTestDynamicOverlay
1212
1313// NB: Deprecated after 0.39.0:
1414
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
1819
19- @available ( * , deprecated, renamed: " EnumAction " )
20- public typealias GlobalAction = EnumAction
20+ @available ( * , deprecated, renamed: " EnumAction " )
21+ public typealias GlobalAction = EnumAction
2122
22- @available ( * , deprecated, renamed: " CaseState " )
23- public typealias LocalState = CaseState
23+ @available ( * , deprecated, renamed: " CaseState " )
24+ public typealias LocalState = CaseState
2425
25- @available ( * , deprecated, renamed: " CaseAction " )
26- public typealias LocalAction = CaseAction
27- }
26+ @available ( * , deprecated, renamed: " CaseAction " )
27+ public typealias LocalAction = CaseAction
28+ }
29+ #endif
2830
2931#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
3335
34- @available ( * , deprecated, renamed: " ScopedAction " )
35- public typealias LocalAction = ScopedAction
36- }
36+ @available ( * , deprecated, renamed: " ScopedAction " )
37+ public typealias LocalAction = ScopedAction
38+ }
3739#endif
3840
3941// NB: Deprecated after 0.38.2:
@@ -42,8 +44,8 @@ extension Effect where Failure == Error {
4244 @_disfavoredOverload
4345 @available (
4446 * ,
45- deprecated,
46- message: " Use the non-failing version of 'Effect.task' "
47+ deprecated,
48+ message: " Use the non-failing version of 'Effect.task' "
4749 )
4850 public static func task(
4951 priority: TaskPriority ? = nil ,
@@ -82,8 +84,8 @@ extension Effect where Failure == Error {
8284/// - environment: The environment of dependencies for the application.
8385@available (
8486 * ,
85- deprecated,
86- message:
87+ deprecated,
88+ message:
8789 """
8890 If you use this initializer, please open a discussion on GitHub and let us know how: \
8991 https://github.com/pointfreeco/swift-composable-architecture/discussions/new
@@ -131,8 +133,8 @@ extension ViewStore {
131133extension Effect {
132134 @available (
133135 * ,
134- deprecated,
135- message:
136+ deprecated,
137+ message:
136138 """
137139 Using a variadic list is no longer supported. Use an array of identifiers instead. For more \
138140 on this change, see: https://github.com/pointfreeco/swift-composable-architecture/pull/1041
@@ -149,8 +151,8 @@ extension Effect {
149151extension Reducer {
150152 @available (
151153 * ,
152- deprecated,
153- message: " 'pullback' no longer takes a 'breakpointOnNil' argument "
154+ deprecated,
155+ message: " 'pullback' no longer takes a 'breakpointOnNil' argument "
154156 )
155157 public func pullback< ParentState, ParentAction, ParentEnvironment> (
156158 state toChildState: CasePath < ParentState , State > ,
@@ -171,8 +173,8 @@ extension Reducer {
171173
172174 @available (
173175 * ,
174- deprecated,
175- message: " 'optional' no longer takes a 'breakpointOnNil' argument "
176+ deprecated,
177+ message: " 'optional' no longer takes a 'breakpointOnNil' argument "
176178 )
177179 public func optional(
178180 breakpointOnNil: Bool ,
@@ -186,8 +188,8 @@ extension Reducer {
186188
187189 @available (
188190 * ,
189- deprecated,
190- message: " 'forEach' no longer takes a 'breakpointOnNil' argument "
191+ deprecated,
192+ message: " 'forEach' no longer takes a 'breakpointOnNil' argument "
191193 )
192194 public func forEach< ParentState, ParentAction, ParentEnvironment, ID> (
193195 state toElementsState: WritableKeyPath < ParentState , IdentifiedArray < ID , State > > ,
@@ -208,8 +210,8 @@ extension Reducer {
208210
209211 @available (
210212 * ,
211- deprecated,
212- message: " 'forEach' no longer takes a 'breakpointOnNil' argument "
213+ deprecated,
214+ message: " 'forEach' no longer takes a 'breakpointOnNil' argument "
213215 )
214216 public func forEach< ParentState, ParentAction, ParentEnvironment, Key> (
215217 state toElementsState: WritableKeyPath < ParentState , [ Key : State ] > ,
@@ -265,13 +267,13 @@ extension Reducer {
265267 var actions = " "
266268 customDump ( self . receivedActions. map ( \. action) , to: & actions)
267269 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: …
271273
272- Unhandled actions: \( actions)
273- """ ,
274- file: step. file, line: step. line
274+ Unhandled actions: \( actions)
275+ """ ,
276+ file: step. file, line: step. line
275277 )
276278 }
277279 do {
@@ -285,13 +287,13 @@ extension Reducer {
285287 var actions = " "
286288 customDump ( self . receivedActions. map ( \. action) , to: & actions)
287289 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: …
291293
292- Unhandled actions: \( actions)
293- """ ,
294- file: step. file, line: step. line
294+ Unhandled actions: \( actions)
295+ """ ,
296+ file: step. file, line: step. line
295297 )
296298 }
297299 do {
@@ -390,14 +392,14 @@ extension Reducer {
390392 }
391393 }
392394 }
393- #endif
395+ #endif
394396
395- // NB: Deprecated after 0.27.1:
396- #if canImport(SwiftUI)
397+ // NB: Deprecated after 0.27.1:
398+ #if canImport(SwiftUI)
397399 extension AlertState . Button {
398400 @available (
399401 * , 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 "
401403 )
402404 public static func cancel( action: AlertState . ButtonAction ? = nil ) -> Self {
403405 . init( action: action, label: TextState ( " Cancel " ) , role: . cancel)
@@ -428,14 +430,16 @@ extension Reducer {
428430 extension Store {
429431 @available (
430432 * , deprecated,
431- message:
433+ message:
432434 """
433435 If you use this method, please open a discussion on GitHub and let us know how: \
434436 https://github.com/pointfreeco/swift-composable-architecture/discussions/new
435437 """
436438 )
437439 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+ > ,
439443 action fromChildAction: @escaping ( ChildAction ) -> Action
440444 ) -> SignalProducer < Store < ChildState , ChildAction > , Never > {
441445
@@ -472,14 +476,16 @@ extension Reducer {
472476
473477 @available (
474478 * , deprecated,
475- message:
479+ message:
476480 """
477481 If you use this method, please open a discussion on GitHub and let us know how: \
478482 https://github.com/pointfreeco/swift-composable-architecture/discussions/new
479483 """
480484 )
481485 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+ >
483489 ) -> SignalProducer < Store < ChildState , Action > , Never > {
484490 self . producerScope ( state: toChildState, action: { $0 } )
485491 }
@@ -488,7 +494,7 @@ extension Reducer {
488494 extension ViewStore where Action: BindableAction , Action. State == State {
489495 @available (
490496 * , deprecated,
491- message:
497+ message:
492498 """
493499 Dynamic member lookup is no longer supported for bindable state. Instead of dot-chaining on \
494500 the view store, e.g. 'viewStore.$value', invoke the 'binding' method on view store with a \
@@ -511,7 +517,7 @@ extension Reducer {
511517 extension BindingAction {
512518 @available (
513519 * , deprecated,
514- message:
520+ message:
515521 """
516522 For improved safety, bindable properties must now be wrapped explicitly in 'BindableState', \
517523 and accessed via key paths to that 'BindableState', like ' \\ .$value'
@@ -531,7 +537,7 @@ extension Reducer {
531537
532538 @available (
533539 * , deprecated,
534- message:
540+ message:
535541 """
536542 For improved safety, bindable properties must now be wrapped explicitly in 'BindableState', \
537543 and accessed via key paths to that 'BindableState', like ' \\ .$value'
@@ -548,14 +554,14 @@ extension Reducer {
548554 extension Reducer {
549555 @available (
550556 * , deprecated,
551- message:
557+ message:
552558 """
553559 'Reducer.binding()' no longer takes an explicit extract function and instead the reducer's \
554560 'Action' type must conform to 'BindableAction'
555561 """
556562 )
557563 public func binding( action toBindingAction: @escaping ( Action ) -> BindingAction < State > ? )
558- -> Self
564+ -> Self
559565 {
560566 Self { state, action, environment in
561567 toBindingAction ( action) ? . set ( & state)
@@ -565,27 +571,27 @@ extension Reducer {
565571 }
566572
567573 #if canImport(SwiftUI)
568- extension ViewStore {
569- @available (
570- * , deprecated,
571- message:
572- """
574+ extension ViewStore {
575+ @available (
576+ * , deprecated,
577+ message:
578+ """
573579 For improved safety, bindable properties must now be wrapped explicitly in 'BindableState'. \
574580 Bindings are now derived via 'ViewStore.binding' with a key path to that 'BindableState' \
575581 (for example, 'viewStore.binding( \\ .$value)'). For dynamic member lookup to be available, \
576582 the view store's 'Action' type must also conform to 'BindableAction'.
577583 """
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) ) }
586584 )
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+ }
587594 }
588- }
589595 #endif
590596
591597 // NB: Deprecated after 0.23.0:
@@ -700,10 +706,10 @@ extension Reducer {
700706 @ViewBuilder content: @escaping ( Store < EachState , EachAction > ) -> EachContent
701707 )
702708 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+ >
707713 {
708714 let data = store. state
709715 self . data = data
@@ -727,12 +733,12 @@ extension Reducer {
727733 @ViewBuilder content: @escaping ( Store < EachState , EachAction > ) -> EachContent
728734 )
729735 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
736742 {
737743 self . init ( store, id: \. id, content: content)
738744 }
0 commit comments