I used this today, more than 4 years after the original question and answer by @Rob the Artist. The way I did it with Swift 5 (a bit cleaner) is:
#Preview { struct BindingViewExamplePreviewContainer_2 : View { @State private var value = false var body: some View {
BindingViewExample_2(value: $value)
}
}
return BindingViewExamplePreviewContainer_2()
}
#Preview {
struct BindingViewExamplePreviewContainer : View {
@State private var value = false
var body: some View {
BindingViewExample(value: $value)
}
}
return BindingViewExamplePreviewContainer()
}