Skip to content

Commit 2609c22

Browse files
lukeredpathmluisbrown
authored andcommitted
Conform BindableState to CustomDebugStringConvertible (#777)
This ensures that bindable state properties are displayed in a useful way when using `.dump` snapshot tests on your app state.
1 parent a0fa3a7 commit 2609c22

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/ComposableArchitecture/SwiftUI/Binding.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ import SwiftUI
228228
// }
229229
// }
230230

231+
extension BindableState: CustomDebugStringConvertible where Value: CustomDebugStringConvertible {
232+
public var debugDescription: String {
233+
self.wrappedValue.debugDescription
234+
}
235+
}
236+
231237
/// An action type that exposes a `binding` case for the purpose of reducing.
232238
///
233239
/// Used in conjunction with ``BindableState`` to safely eliminate the boilerplate typically

0 commit comments

Comments
 (0)