本文へスキップ

Picker

メニュー、セグメント、ラジオグループ、インラインの各スタイルに対応した、制御された SwiftUI Picker です。

#インポート

github.com/egoist/quickgui/go/ui から ui をインポートします。

import (
	"github.com/egoist/quickgui/go/native"
	"github.com/egoist/quickgui/go/ui"
)

#使い方

func SwiftUiPickerExample() *native.Node {
	value, setValue := ui.CreateSignal("list")
	return ui.SwiftUI.Host(
		ui.SwiftUIHostProps{MatchContents: true},
		func() *native.Node {
			return ui.SwiftUI.Picker(ui.SwiftUIPickerProps{
				Selection:         value,
				Options:           []ui.SwiftUIPickerOption{{Value: "list", Label: "List"}, {Value: "grid", Label: "Grid"}},
				OnSelectionChange: func(next string, _ *native.Event) { setValue(next) },
			})
		},
	)
}

#API リファレンス

項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。

SwiftUI.Picker

ソースを見る
ui.SwiftUI.Picker(props SwiftUIPickerProps) *native.Node
TestIDany—

Stable identifier for native automation and tests.

any
ソースを見る
Modifiersany—

Ordered SwiftUI view modifiers applied to the hosted control.

any
ソースを見る
Reffunc(*native.Node)—

Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.

func(*native.Node)
ソースを見る
Selectionany—

Controlled selection for a table, native picker, or color control.

any
ソースを見る
Optionsany—

Ordered native picker options.

any
ソースを見る
Labelany—

Visible native SwiftUI control label.

any
ソースを見る
Stylestring—

Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.

string
ソースを見る
OnSelectionChangefunc(string, *native.Event)—

Reports the selected native picker option or color.

func(string, *native.Event)
ソースを見る