I have a view ButtonView
with a @Binding var engine: CHHapticEngine?
. I call it from my other views with ButtonView(engine: $engine)
, but I can’t seem to work out how to call it from #Preview
so the canvas will work.
I’ve tried several variations of this to no avail:
#Preview {
@State var engine: CHHapticEngine?
_ = ButtonView(engine: $engine)
}
What should I put in my #Preview
block to make this work?