|
78 | 78 | }
|
79 | 79 | }
|
80 | 80 |
|
81 |
| -#if DEBUG |
82 |
| - private final class BindableActionDebugger<Action>: Sendable { |
83 |
| - let isInvalidated: @MainActor @Sendable () -> Bool |
84 |
| - let value: any Sendable |
85 |
| - let wasCalled = LockIsolated(false) |
86 |
| - init( |
87 |
| - value: some Sendable, |
88 |
| - isInvalidated: @escaping @MainActor @Sendable () -> Bool |
89 |
| - ) { |
90 |
| - self.value = value |
91 |
| - self.isInvalidated = isInvalidated |
92 |
| - } |
93 |
| - deinit { |
94 |
| - let isInvalidated = mainActorNow(execute: isInvalidated) |
95 |
| - guard !isInvalidated else { return } |
96 |
| - guard wasCalled.value else { |
97 |
| - var valueDump: String { |
98 |
| - var valueDump = "" |
99 |
| - customDump(self.value, to: &valueDump, maxDepth: 0) |
100 |
| - return valueDump |
| 81 | + #if DEBUG |
| 82 | + private final class BindableActionDebugger<Action>: Sendable { |
| 83 | + let isInvalidated: @MainActor @Sendable () -> Bool |
| 84 | + let value: any Sendable |
| 85 | + let wasCalled = LockIsolated(false) |
| 86 | + init( |
| 87 | + value: some Sendable, |
| 88 | + isInvalidated: @escaping @MainActor @Sendable () -> Bool |
| 89 | + ) { |
| 90 | + self.value = value |
| 91 | + self.isInvalidated = isInvalidated |
| 92 | + } |
| 93 | + deinit { |
| 94 | + let isInvalidated = mainActorNow(execute: isInvalidated) |
| 95 | + guard !isInvalidated else { return } |
| 96 | + guard wasCalled.value else { |
| 97 | + var valueDump: String { |
| 98 | + var valueDump = "" |
| 99 | + customDump(self.value, to: &valueDump, maxDepth: 0) |
| 100 | + return valueDump |
| 101 | + } |
| 102 | + reportIssue( |
| 103 | + """ |
| 104 | + A binding action sent from a store was not handled. … |
| 105 | +
|
| 106 | + Action: |
| 107 | + \(typeName(Action.self)).binding(.set(_, \(valueDump))) |
| 108 | +
|
| 109 | + To fix this, invoke "BindingReducer()" from your feature reducer's "body". |
| 110 | + """ |
| 111 | + ) |
| 112 | + return |
101 | 113 | }
|
102 |
| - reportIssue( |
103 |
| - """ |
104 |
| - A binding action sent from a store was not handled. … |
105 |
| -
|
106 |
| - Action: |
107 |
| - \(typeName(Action.self)).binding(.set(_, \(valueDump))) |
108 |
| -
|
109 |
| - To fix this, invoke "BindingReducer()" from your feature reducer's "body". |
110 |
| - """ |
111 |
| - ) |
112 |
| - return |
113 | 114 | }
|
114 | 115 | }
|
115 |
| - } |
116 |
| -#endif |
| 116 | + #endif |
117 | 117 |
|
118 | 118 | extension BindableAction where State: ObservableState {
|
119 | 119 | fileprivate static func set<Value: Equatable & Sendable>(
|
|
0 commit comments