ColorPicker
原生 SwiftUI 颜色选择器,返回 CSS 风格的 RGBA 颜色字符串。
#导入
从 github.com/egoist/quickgui/go/ui 导入 ui。
import (
"github.com/egoist/quickgui/go/native"
"github.com/egoist/quickgui/go/ui"
)#用法
func SwiftUiColorPickerExample() *native.Node {
value, setValue := ui.CreateSignal("#2563ebff")
return ui.SwiftUI.Host(
ui.SwiftUIHostProps{MatchContents: true},
func() *native.Node {
return ui.SwiftUI.ColorPicker(ui.SwiftUIColorPickerProps{
Selection: value,
Label: "Accent",
SupportsOpacity: true,
OnSelectionChange: func(next string, _ *native.Event) { setValue(next) },
})
},
)
}#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
SwiftUI.ColorPicker
查看源码ui.SwiftUI.ColorPicker(props SwiftUIColorPickerProps) *native.NodeTestIDany—
Modifiersany—
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)查看源码