Skip to content

0.0.8

Choose a tag to compare

@mdb1 mdb1 released this 11 Apr 15:13
· 3 commits to main since this release
  • Add DebugState modifier

For DEBUG builds, there is a view extension that you can apply to any view, that lets you modify the state of the controller with ease.

/// Applies the debug state modifier to the view.
/// By tapping 3 times on the view, a modal will be displayed with options to debug
/// the state of the controller.
extension View {
    public func debugState<Info>(
        controller: Binding<ViewStateController<Info>>,
        mockInfo: Info
    ) -> some View {
        #if DEBUG
        // Only apply the debug state modifier in debug builds
        self.modifier(DebugStateModifier(controller: controller, mockInfo: mockInfo))
        #endif
    }
}

Usage:

someView
    .debugState(controller: $controller, mockInfo: someMockInfo)
Screen.Recording.2023-04-11.at.12.09.35.mov