跳到正文

QuickGUIHostView

在 SwiftUI 层级中反向托管一棵普通的 QuickGUI 子树。

#导入

从 github.com/egoist/quickgui/go/ui 导入 ui。

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

#用法

func SwiftUiQuickguiHostViewExample() *native.Node {
	return ui.SwiftUI.Host(
		ui.SwiftUIHostProps{MatchContents: true},
		func() *native.Node {
			return ui.SwiftUI.QuickGUIHostView(
				ui.SwiftUIQuickGUIHostViewProps{Width: 320, Height: 180},
				func() *ui.Element {
					return ui.View().Child(
						"QuickGUI inside SwiftUI",
					).Width("100%").Height("100%").Padding(16)
				},
			)
		},
	)
}

#API 参考

展开条目查看说明和完整签名。短横线表示声明中未记录默认值。

SwiftUI.QuickGUIHostView

查看源码
ui.SwiftUI.QuickGUIHostView(props SwiftUIQuickGUIHostViewProps, children ...any) *native.Node

QuickGUIHostView is an independently owned QuickGUI renderer inside a SwiftUI hierarchy.

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)
查看源码
ChildrenComponent—

Content mounted inside the component. Compound child callbacks run after the parent context exists.

Component
查看源码
Widthany—

Declared logical width.

any
查看源码
Heightany—

Declared logical height.

any
查看源码
MatchContentsany—

Uses the hosted subtree’s intrinsic width, height, or both.

any
查看源码
Backgroundany—

Clear color for the reverse-hosted QuickGUI WGPU surface.

any
查看源码