|
19 | 19 | ) -> some View
|
20 | 20 | where Content: View {
|
21 | 21 | self.fullScreenCover(
|
22 |
| - isPresented: value.isPresent(), |
| 22 | + isPresented: Binding(value), |
23 | 23 | onDismiss: onDismiss
|
24 | 24 | ) {
|
25 | 25 | Binding(unwrapping: value).map(content)
|
|
41 | 41 | if requiresBindWorkaround {
|
42 | 42 | self.modifier(
|
43 | 43 | _NavigationDestinationBindWorkaround(
|
44 |
| - isPresented: value.isPresent(), |
| 44 | + isPresented: Binding(value), |
45 | 45 | destination: Binding(unwrapping: value).map(destination)
|
46 | 46 | )
|
47 | 47 | )
|
48 | 48 | } else {
|
49 |
| - self.navigationDestination(isPresented: value.isPresent()) { |
| 49 | + self.navigationDestination(isPresented: Binding(value)) { |
50 | 50 | Binding(unwrapping: value).map(destination)
|
51 | 51 | }
|
52 | 52 | }
|
|
92 | 92 | @ViewBuilder content: @escaping (Binding<Value>) -> Content
|
93 | 93 | ) -> some View {
|
94 | 94 | self.popover(
|
95 |
| - isPresented: value.isPresent(), |
| 95 | + isPresented: Binding(value), |
96 | 96 | attachmentAnchor: attachmentAnchor,
|
97 | 97 | arrowEdge: arrowEdge
|
98 | 98 | ) {
|
|
112 | 112 | @ViewBuilder content: @escaping (Binding<Value>) -> Content
|
113 | 113 | ) -> some View
|
114 | 114 | where Content: View {
|
115 |
| - self.sheet(isPresented: value.isPresent(), onDismiss: onDismiss) { |
| 115 | + self.sheet(isPresented: Binding(value), onDismiss: onDismiss) { |
116 | 116 | Binding(unwrapping: value).map(content)
|
117 | 117 | }
|
118 | 118 | }
|
|
132 | 132 | ) where Destination == WrappedDestination? {
|
133 | 133 | self.init(
|
134 | 134 | destination: Binding(unwrapping: value).map(destination),
|
135 |
| - isActive: value.isPresent().didSet(onNavigate), |
| 135 | + isActive: Binding(value).didSet(onNavigate), |
136 | 136 | label: label
|
137 | 137 | )
|
138 | 138 | }
|
|
164 | 164 | ) -> some View {
|
165 | 165 | self.confirmationDialog(
|
166 | 166 | value.wrappedValue.map(title) ?? Text(verbatim: ""),
|
167 |
| - isPresented: value.isPresent(), |
| 167 | + isPresented: Binding(value), |
168 | 168 | titleVisibility: titleVisibility,
|
169 | 169 | presenting: value.wrappedValue,
|
170 | 170 | actions: actions,
|
|
184 | 184 | ) -> some View {
|
185 | 185 | alert(
|
186 | 186 | (value.wrappedValue?.title).map(Text.init) ?? Text(verbatim: ""),
|
187 |
| - isPresented: value.isPresent(), |
| 187 | + isPresented: Binding(value), |
188 | 188 | presenting: value.wrappedValue,
|
189 | 189 | actions: {
|
190 | 190 | ForEach($0.buttons) {
|
|
196 | 196 | }
|
197 | 197 |
|
198 | 198 | @available(*, deprecated, renamed: "alert(_:action:)")
|
199 |
| - public func alert<Value>( |
| 199 | + public func alert<Value: Sendable>( |
200 | 200 | unwrapping value: Binding<AlertState<Value>?>,
|
201 |
| - action handler: @escaping (Value?) async -> Void = { (_: Never?) async in } |
| 201 | + action handler: @escaping @Sendable (Value?) async -> Void = { (_: Never?) async in } |
202 | 202 | ) -> some View {
|
203 | 203 | alert(
|
204 | 204 | (value.wrappedValue?.title).map(Text.init) ?? Text(verbatim: ""),
|
205 |
| - isPresented: value.isPresent(), |
| 205 | + isPresented: Binding(value), |
206 | 206 | presenting: value.wrappedValue,
|
207 | 207 | actions: {
|
208 | 208 | ForEach($0.buttons) {
|
|
220 | 220 | ) -> some View {
|
221 | 221 | confirmationDialog(
|
222 | 222 | value.wrappedValue.flatMap { Text($0.title) } ?? Text(verbatim: ""),
|
223 |
| - isPresented: value.isPresent(), |
| 223 | + isPresented: Binding(value), |
224 | 224 | titleVisibility: value.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic,
|
225 | 225 | presenting: value.wrappedValue,
|
226 | 226 | actions: {
|
|
233 | 233 | }
|
234 | 234 |
|
235 | 235 | @available(*, deprecated, renamed: "confirmationDialog(_:action:)")
|
236 |
| - public func confirmationDialog<Value>( |
| 236 | + public func confirmationDialog<Value: Sendable>( |
237 | 237 | unwrapping value: Binding<ConfirmationDialogState<Value>?>,
|
238 |
| - action handler: @escaping (Value?) async -> Void = { (_: Never?) async in } |
| 238 | + action handler: @escaping @Sendable (Value?) async -> Void = { (_: Never?) async in } |
239 | 239 | ) -> some View {
|
240 | 240 | confirmationDialog(
|
241 | 241 | value.wrappedValue.flatMap { Text($0.title) } ?? Text(verbatim: ""),
|
242 |
| - isPresented: value.isPresent(), |
| 242 | + isPresented: Binding(value), |
243 | 243 | titleVisibility: value.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic,
|
244 | 244 | presenting: value.wrappedValue,
|
245 | 245 | actions: {
|
|
292 | 292 | message:
|
293 | 293 | "Chain a '@CasePathable' enum binding into a case directly instead of specifying a case path."
|
294 | 294 | )
|
295 |
| - public func alert<Enum, Value>( |
| 295 | + public func alert<Enum, Value: Sendable>( |
296 | 296 | unwrapping enum: Binding<Enum?>,
|
297 | 297 | case casePath: AnyCasePath<Enum, AlertState<Value>>,
|
298 |
| - action handler: @escaping (Value?) async -> Void = { (_: Never?) async in } |
| 298 | + action handler: @escaping @Sendable (Value?) async -> Void = { (_: Never?) async in } |
299 | 299 | ) -> some View {
|
300 | 300 | alert(`enum`.case(casePath), action: handler)
|
301 | 301 | }
|
|
343 | 343 | message:
|
344 | 344 | "Chain a '@CasePathable' enum binding into a case directly instead of specifying a case path."
|
345 | 345 | )
|
346 |
| - public func confirmationDialog<Enum, Value>( |
| 346 | + public func confirmationDialog<Enum, Value: Sendable>( |
347 | 347 | unwrapping enum: Binding<Enum?>,
|
348 | 348 | case casePath: AnyCasePath<Enum, ConfirmationDialogState<Value>>,
|
349 |
| - action handler: @escaping (Value?) async -> Void = { (_: Never?) async in } |
| 349 | + action handler: @escaping @Sendable (Value?) async -> Void = { (_: Never?) async in } |
350 | 350 | ) -> some View {
|
351 | 351 | confirmationDialog(
|
352 | 352 | `enum`.case(casePath),
|
|
521 | 521 | )
|
522 | 522 | public func isPresent<Enum, Case>(_ casePath: AnyCasePath<Enum, Case>) -> Binding<Bool>
|
523 | 523 | where Value == Enum? {
|
524 |
| - self.case(casePath).isPresent() |
| 524 | + .init(self.case(casePath)) |
525 | 525 | }
|
526 | 526 | }
|
527 | 527 |
|
|
767 | 767 | message:
|
768 | 768 | "Switch over a '@CasePathable' enum and derive bindings from each case using '$enum.case.map { $case in … }', instead."
|
769 | 769 | )
|
770 |
| - public struct CaseLet<Enum, Case, Content>: View |
| 770 | + public struct CaseLet<Enum, Case, Content>: Sendable, View |
771 | 771 | where Content: View {
|
772 | 772 | @EnvironmentObject private var `enum`: BindingObject<Enum>
|
773 | 773 | public let casePath: AnyCasePath<Enum, Case>
|
|
1847 | 1847 | message:
|
1848 | 1848 | "'View.alert' now passes an optional action to its handler to allow you to handle action-less dismissals."
|
1849 | 1849 | )
|
1850 |
| - public func alert<Value>( |
| 1850 | + public func alert<Value: Sendable>( |
1851 | 1851 | unwrapping value: Binding<AlertState<Value>?>,
|
1852 |
| - action handler: @escaping (Value) async -> Void = { (_: Void) async in } |
| 1852 | + action handler: @escaping @Sendable (Value) async -> Void = { (_: Void) async in } |
1853 | 1853 | ) -> some View {
|
1854 | 1854 | alert(value) { (value: Value?) in
|
1855 | 1855 | if let value = value {
|
|
1865 | 1865 | message:
|
1866 | 1866 | "'View.alert' now passes an optional action to its handler to allow you to handle action-less dismissals."
|
1867 | 1867 | )
|
1868 |
| - public func alert<Enum, Value>( |
| 1868 | + public func alert<Enum, Value: Sendable>( |
1869 | 1869 | unwrapping enum: Binding<Enum?>,
|
1870 | 1870 | case casePath: CasePath<Enum, AlertState<Value>>,
|
1871 |
| - action handler: @escaping (Value) async -> Void = { (_: Void) async in } |
| 1871 | + action handler: @escaping @Sendable (Value) async -> Void = { (_: Void) async in } |
1872 | 1872 | ) -> some View {
|
1873 | 1873 | alert(unwrapping: `enum`, case: casePath) { (value: Value?) async in
|
1874 | 1874 | if let value = value {
|
|
1884 | 1884 | message:
|
1885 | 1885 | "'View.alert' now passes an optional action to its handler to allow you to handle action-less dismissals."
|
1886 | 1886 | )
|
1887 |
| - public func confirmationDialog<Value>( |
| 1887 | + public func confirmationDialog<Value: Sendable>( |
1888 | 1888 | unwrapping value: Binding<ConfirmationDialogState<Value>?>,
|
1889 |
| - action handler: @escaping (Value) async -> Void = { (_: Void) async in } |
| 1889 | + action handler: @escaping @Sendable (Value) async -> Void = { (_: Void) async in } |
1890 | 1890 | ) -> some View {
|
1891 | 1891 | confirmationDialog(unwrapping: value) { (value: Value?) in
|
1892 | 1892 | if let value = value {
|
|
1902 | 1902 | message:
|
1903 | 1903 | "'View.alert' now passes an optional action to its handler to allow you to handle action-less dismissals."
|
1904 | 1904 | )
|
1905 |
| - public func confirmationDialog<Enum, Value>( |
| 1905 | + public func confirmationDialog<Enum, Value: Sendable>( |
1906 | 1906 | unwrapping enum: Binding<Enum?>,
|
1907 | 1907 | case casePath: CasePath<Enum, ConfirmationDialogState<Value>>,
|
1908 |
| - action handler: @escaping (Value) async -> Void = { (_: Void) async in } |
| 1908 | + action handler: @escaping @Sendable (Value) async -> Void = { (_: Void) async in } |
1909 | 1909 | ) -> some View {
|
1910 | 1910 | confirmationDialog(unwrapping: `enum`, case: casePath) { (value: Value?) async in
|
1911 | 1911 | if let value = value {
|
|
1941 | 1941 | ) where Destination == WrappedDestination? {
|
1942 | 1942 | self.init(
|
1943 | 1943 | destination: Binding(unwrapping: value).map(destination),
|
1944 |
| - isActive: value.isPresent().didSet(onNavigate), |
| 1944 | + isActive: Binding(value).didSet(onNavigate), |
1945 | 1945 | label: label
|
1946 | 1946 | )
|
1947 | 1947 | }
|
|
0 commit comments