Button
テキスト、SF Symbol、セマンティックロール、押下処理に対応したネイティブ SwiftUI Button です。
#インポート
github.com/egoist/quickgui/go/ui から ui をインポートします。
import (
"fmt"
"github.com/egoist/quickgui/go/native"
"github.com/egoist/quickgui/go/ui"
)#使い方
func SwiftUiButtonExample() *native.Node {
return ui.SwiftUI.Host(
ui.SwiftUIHostProps{MatchContents: true},
func() *native.Node {
return ui.SwiftUI.Button(ui.SwiftUIButtonProps{
Label: "Save",
SystemImage: "checkmark",
OnPress: func(*native.Event) { fmt.Println("Saved") },
Modifiers: []ui.SwiftUIModifier{ui.SwiftUI.ButtonStyle("borderedProminent")},
})
},
)
}#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
SwiftUI.Button
ソースを見るui.SwiftUI.Button(props SwiftUIButtonProps, children ...any) *native.NodeTestIDany—
Modifiersany—
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)ソースを見るLabelany—
SystemImagestring—
Rolestring—
OnPressfunc(*native.Event)—
Targetstring—
ChildrenComponent—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
Componentソースを見る