|
1 | 1 | #if canImport(SwiftUI)
|
2 | 2 |
|
3 |
| -import SwiftUI |
| 3 | + import SwiftUI |
4 | 4 |
|
5 |
| -// NB: Deprecated after 0.17.0: |
| 5 | + // NB: Deprecated after 0.17.0: |
6 | 6 |
|
7 | 7 | @available(iOS 13, macOS 10.15, macCatalyst 13, tvOS 13, watchOS 6, *)
|
8 |
| -extension IfLetStore { |
9 |
| - @available(*, deprecated, message: "'else' now takes a view builder closure") |
10 |
| - public init<IfContent, ElseContent>( |
11 |
| - _ store: Store<State?, Action>, |
12 |
| - @ViewBuilder then ifContent: @escaping (Store<State, Action>) -> IfContent, |
13 |
| - else elseContent: @escaping @autoclosure () -> ElseContent |
14 |
| - ) where Content == _ConditionalContent<IfContent, ElseContent> { |
15 |
| - self.init(store, then: ifContent, else: elseContent) |
| 8 | + extension IfLetStore { |
| 9 | + @available(*, deprecated, message: "'else' now takes a view builder closure") |
| 10 | + public init<IfContent, ElseContent>( |
| 11 | + _ store: Store<State?, Action>, |
| 12 | + @ViewBuilder then ifContent: @escaping (Store<State, Action>) -> IfContent, |
| 13 | + else elseContent: @escaping @autoclosure () -> ElseContent |
| 14 | + ) where Content == _ConditionalContent<IfContent, ElseContent> { |
| 15 | + self.init(store, then: ifContent, else: elseContent) |
| 16 | + } |
16 | 17 | }
|
17 |
| -} |
18 | 18 |
|
19 |
| -// NB: Deprecated after 0.10.0: |
| 19 | + // NB: Deprecated after 0.10.0: |
20 | 20 |
|
21 | 21 | @available(iOS 13, macOS 10.15, macCatalyst 13, tvOS 13, watchOS 6, *)
|
22 |
| -extension ActionSheetState { |
23 |
| - @available(*, deprecated, message: "'title' and 'message' should be 'TextState'") |
24 |
| - @_disfavoredOverload |
25 |
| - public init( |
26 |
| - title: LocalizedStringKey, |
27 |
| - message: LocalizedStringKey? = nil, |
28 |
| - buttons: [Button] |
29 |
| - ) { |
30 |
| - self.init( |
31 |
| - title: .init(title), |
32 |
| - message: message.map { .init($0) }, |
33 |
| - buttons: buttons |
34 |
| - ) |
| 22 | + extension ActionSheetState { |
| 23 | + @available(*, deprecated, message: "'title' and 'message' should be 'TextState'") |
| 24 | + @_disfavoredOverload |
| 25 | + public init( |
| 26 | + title: LocalizedStringKey, |
| 27 | + message: LocalizedStringKey? = nil, |
| 28 | + buttons: [Button] |
| 29 | + ) { |
| 30 | + self.init( |
| 31 | + title: .init(title), |
| 32 | + message: message.map { .init($0) }, |
| 33 | + buttons: buttons |
| 34 | + ) |
| 35 | + } |
35 | 36 | }
|
36 |
| -} |
37 | 37 |
|
38 | 38 | @available(iOS 13, macOS 10.15, macCatalyst 13, tvOS 13, watchOS 6, *)
|
39 |
| -extension AlertState { |
40 |
| - @available(*, deprecated, message: "'title' and 'message' should be 'TextState'") |
41 |
| - @_disfavoredOverload |
42 |
| - public init( |
43 |
| - title: LocalizedStringKey, |
44 |
| - message: LocalizedStringKey? = nil, |
45 |
| - dismissButton: Button? = nil |
46 |
| - ) { |
47 |
| - self.init( |
48 |
| - title: .init(title), |
49 |
| - message: message.map { .init($0) }, |
50 |
| - dismissButton: dismissButton |
51 |
| - ) |
52 |
| - } |
| 39 | + extension AlertState { |
| 40 | + @available(*, deprecated, message: "'title' and 'message' should be 'TextState'") |
| 41 | + @_disfavoredOverload |
| 42 | + public init( |
| 43 | + title: LocalizedStringKey, |
| 44 | + message: LocalizedStringKey? = nil, |
| 45 | + dismissButton: Button? = nil |
| 46 | + ) { |
| 47 | + self.init( |
| 48 | + title: .init(title), |
| 49 | + message: message.map { .init($0) }, |
| 50 | + dismissButton: dismissButton |
| 51 | + ) |
| 52 | + } |
53 | 53 |
|
54 |
| - @available(*, deprecated, message: "'title' and 'message' should be 'TextState'") |
55 |
| - @_disfavoredOverload |
56 |
| - public init( |
57 |
| - title: LocalizedStringKey, |
58 |
| - message: LocalizedStringKey? = nil, |
59 |
| - primaryButton: Button, |
60 |
| - secondaryButton: Button |
61 |
| - ) { |
62 |
| - self.init( |
63 |
| - title: .init(title), |
64 |
| - message: message.map { .init($0) }, |
65 |
| - primaryButton: primaryButton, |
66 |
| - secondaryButton: secondaryButton |
67 |
| - ) |
| 54 | + @available(*, deprecated, message: "'title' and 'message' should be 'TextState'") |
| 55 | + @_disfavoredOverload |
| 56 | + public init( |
| 57 | + title: LocalizedStringKey, |
| 58 | + message: LocalizedStringKey? = nil, |
| 59 | + primaryButton: Button, |
| 60 | + secondaryButton: Button |
| 61 | + ) { |
| 62 | + self.init( |
| 63 | + title: .init(title), |
| 64 | + message: message.map { .init($0) }, |
| 65 | + primaryButton: primaryButton, |
| 66 | + secondaryButton: secondaryButton |
| 67 | + ) |
| 68 | + } |
68 | 69 | }
|
69 |
| -} |
70 | 70 |
|
71 | 71 | @available(iOS 13, macOS 10.15, macCatalyst 13, tvOS 13, watchOS 6, *)
|
72 |
| -extension AlertState.Button { |
73 |
| - @available(*, deprecated, message: "'label' should be 'TextState'") |
74 |
| - @_disfavoredOverload |
75 |
| - public static func cancel( |
76 |
| - _ label: LocalizedStringKey, |
77 |
| - send action: Action? = nil |
78 |
| - ) -> Self { |
79 |
| - Self(action: action, type: .cancel(label: .init(label))) |
80 |
| - } |
| 72 | + extension AlertState.Button { |
| 73 | + @available(*, deprecated, message: "'label' should be 'TextState'") |
| 74 | + @_disfavoredOverload |
| 75 | + public static func cancel( |
| 76 | + _ label: LocalizedStringKey, |
| 77 | + send action: Action? = nil |
| 78 | + ) -> Self { |
| 79 | + Self(action: action, type: .cancel(label: .init(label))) |
| 80 | + } |
81 | 81 |
|
82 |
| - @available(*, deprecated, message: "'label' should be 'TextState'") |
83 |
| - @_disfavoredOverload |
84 |
| - public static func `default`( |
85 |
| - _ label: LocalizedStringKey, |
86 |
| - send action: Action? = nil |
87 |
| - ) -> Self { |
88 |
| - Self(action: action, type: .default(label: .init(label))) |
89 |
| - } |
| 82 | + @available(*, deprecated, message: "'label' should be 'TextState'") |
| 83 | + @_disfavoredOverload |
| 84 | + public static func `default`( |
| 85 | + _ label: LocalizedStringKey, |
| 86 | + send action: Action? = nil |
| 87 | + ) -> Self { |
| 88 | + Self(action: action, type: .default(label: .init(label))) |
| 89 | + } |
90 | 90 |
|
91 |
| - @available(*, deprecated, message: "'label' should be 'TextState'") |
92 |
| - @_disfavoredOverload |
93 |
| - public static func destructive( |
94 |
| - _ label: LocalizedStringKey, |
95 |
| - send action: Action? = nil |
96 |
| - ) -> Self { |
97 |
| - Self(action: action, type: .destructive(label: .init(label))) |
| 91 | + @available(*, deprecated, message: "'label' should be 'TextState'") |
| 92 | + @_disfavoredOverload |
| 93 | + public static func destructive( |
| 94 | + _ label: LocalizedStringKey, |
| 95 | + send action: Action? = nil |
| 96 | + ) -> Self { |
| 97 | + Self(action: action, type: .destructive(label: .init(label))) |
| 98 | + } |
98 | 99 | }
|
99 |
| -} |
100 | 100 | #endif
|
101 | 101 |
|
102 | 102 | // NB: Deprecated after 0.9.0:
|
|
0 commit comments