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