Post

Replies

Boosts

Views

Activity

Reply to How to preview a custom View that takes bindings as inputs in its initializer?
You can add another SwiftUI View that acts as a preview container to hold the state you need for the toggle.struct BindingViewExamplePreviewContainer_2 : View { @State private var value = false var body: some View { BindingViewExample_2(value: $value) } } #if DEBUG struct BindingViewExample_2_Previews : PreviewProvider { static var previews: some View { BindingViewExamplePreviewContainer_2() } } #endif
Dec ’19