PopupSwiftUI icon indicating copy to clipboard operation
PopupSwiftUI copied to clipboard

Passing binding variables to the popup

Open ClaesClaes opened this issue 3 years ago • 1 comments

HI, thanks for a nice write up on your blog and code on how to create popups. I got inspired and tried to use the snackbar example to crate a hue color slider popup. The hue color slider has two binding variable (Color and slider knob position).

So, how can I pass those bindings to/from the snackbar popup? I've tried the following but it fails and I'm not sure how to pass those two bindings to the snackbar:

.popup(isPresented: showHuePicker, alignment: .center, direction: .bottom, content: huePicker.init(color: $color1, knobLocation: $knobLocation))

ClaesClaes avatar Apr 15 '21 08:04 ClaesClaes

.popup(isPresented: showHuePicker, alignment: .center, direction: .bottom, content: {huePicker.init(color: $color1, knobLocation: $knobLocation})) try wrap it in {} , It work for me. @ClaesClaes

trungnt1995 avatar Nov 04 '21 08:11 trungnt1995