Host
基于 NSHostingView 的叶节点,用于在 QuickGUI 中挂载一棵 SwiftUI 组件树。
#导入
从 github.com/egoist/quickgui/go/ui 导入 ui。
import (
"github.com/egoist/quickgui/go/ui"
)#用法
func SwiftUiHostExample() *native.Node {
return ui.SwiftUI.Host(
ui.SwiftUIHostProps{MatchContents: true},
func() *native.Node {
return ui.SwiftUI.Button(ui.SwiftUIButtonProps{Label: "Continue"})
},
)
}#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
SwiftUI.Host
查看源码ui.SwiftUI.Host(props SwiftUIHostProps, children ...any) *native.NodeHost is a native NSHostingView laid out as one QuickGUI leaf.
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)查看源码Styleany—
Reusable layout, typography, color, and interaction-state styles. Build with ui.Style() and compose with Merge.
any查看源码ChildrenPartChildren—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
PartChildren查看源码Disabledany—
Prevents activation and exposes the disabled state to accessibility. Compound parts inherit a disabled root.
any查看源码Rolestring—
FocusOnPointerany—
Groupany—
AriaLabelany—
TabIndex*float64—
Controls sequential keyboard focus order. Omit to retain the component’s default focus behavior.
*float64查看源码OnClickfunc(*native.Event)—
Called after QuickGUI resolves an activation, including supported keyboard activation.
func(*native.Event)查看源码