|
19 | 19 | _ state: Binding<ConfirmationDialogState<Value>?>,
|
20 | 20 | action handler: @escaping (Value?) -> Void = { (_: Never?) in }
|
21 | 21 | ) -> some View {
|
22 |
| - self.confirmationDialog( |
23 |
| - state.wrappedValue.flatMap { Text($0.title) } ?? Text(verbatim: ""), |
24 |
| - isPresented: state.isPresent(), |
25 |
| - titleVisibility: state.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic, |
26 |
| - presenting: state.wrappedValue, |
27 |
| - actions: { |
28 |
| - ForEach($0.buttons) { |
29 |
| - Button($0, action: handler) |
30 |
| - } |
31 |
| - }, |
32 |
| - message: { $0.message.map { Text($0) } } |
33 |
| - ) |
| 22 | + confirmationDialog( |
| 23 | + item: state, |
| 24 | + titleVisibility: state.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic |
| 25 | + ) { |
| 26 | + Text($0.title) |
| 27 | + } actions: { |
| 28 | + ForEach($0.buttons) { |
| 29 | + Button($0, action: handler) |
| 30 | + } |
| 31 | + } message: { |
| 32 | + $0.message.map(Text.init) |
| 33 | + } |
34 | 34 | }
|
35 | 35 |
|
36 | 36 | /// Presents a confirmation dialog from a binding to optional confirmation dialog state.
|
|
53 | 53 | _ state: Binding<ConfirmationDialogState<Value>?>,
|
54 | 54 | action handler: @escaping (Value?) async -> Void = { (_: Never?) async in }
|
55 | 55 | ) -> some View {
|
56 |
| - self.confirmationDialog( |
57 |
| - state.wrappedValue.flatMap { Text($0.title) } ?? Text(verbatim: ""), |
58 |
| - isPresented: state.isPresent(), |
59 |
| - titleVisibility: state.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic, |
60 |
| - presenting: state.wrappedValue, |
61 |
| - actions: { |
62 |
| - ForEach($0.buttons) { |
63 |
| - Button($0, action: handler) |
64 |
| - } |
65 |
| - }, |
66 |
| - message: { $0.message.map { Text($0) } } |
67 |
| - ) |
| 56 | + confirmationDialog( |
| 57 | + item: state, |
| 58 | + titleVisibility: state.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic |
| 59 | + ) { |
| 60 | + Text($0.title) |
| 61 | + } actions: { |
| 62 | + ForEach($0.buttons) { |
| 63 | + Button($0, action: handler) |
| 64 | + } |
| 65 | + } message: { |
| 66 | + $0.message.map(Text.init) |
| 67 | + } |
68 | 68 | }
|
69 | 69 | }
|
70 | 70 | #endif // canImport(SwiftUI)
|
0 commit comments