Toggle
A controlled native SwiftUI on/off switch.
#Import
Import ui from github.com/egoist/quickgui/go/ui.
import (
"github.com/egoist/quickgui/go/native"
"github.com/egoist/quickgui/go/ui"
)#Usage
func SwiftUiToggleExample() *native.Node {
on, setOn := ui.CreateSignal(true)
return ui.SwiftUI.Host(
ui.SwiftUIHostProps{MatchContents: true},
func() *native.Node {
return ui.SwiftUI.Toggle(ui.SwiftUIToggleProps{
IsOn: on,
Label: "Notifications",
OnIsOnChange: func(next bool, _ *native.Event) { setOn(next) },
})
},
)
}#API reference
Expand an entry for its description and complete signature. A dash means no declaration default is documented.
SwiftUI.Toggle
View sourceui.SwiftUI.Toggle(props SwiftUIToggleProps) *native.NodeTestIDany—
Modifiersany—
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)View source