Skip to content

Commit e2795c1

Browse files
authored
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 90e9741 commit e2795c1

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
@@ -226,6 +226,12 @@ import SwiftUI
226226
}
227227
}
228228

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

0 commit comments

Comments
 (0)