本文へスキップ

Popover

組み合わせた SwiftUI トリガーから、ネイティブ SwiftUI Popover を表示します。

#インポート

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

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

#使い方

func SwiftUiPopoverExample() *native.Node {
	open, setOpen := ui.CreateSignal(false)
	return ui.SwiftUI.Host(
		ui.SwiftUIHostProps{MatchContents: true},
		func() *native.Node {
			return ui.SwiftUI.Popover.Root(
				ui.SwiftUIPopoverProps{
					IsPresented:         open,
					OnIsPresentedChange: setOpen,
				},
				func() *native.Node {
					return ui.Fragment([]*native.Node{ui.SwiftUI.Popover.Trigger(ui.SwiftUIPopoverTriggerProps{Render: func() *native.Node { return ui.SwiftUI.Button(ui.SwiftUIButtonProps{Label: "Account"}) }}),
						ui.SwiftUI.Popover.Content(
							ui.SwiftUIPopoverContentProps{},
							func() *native.Node {
								return ui.SwiftUI.QuickGUIHostView(
									ui.SwiftUIQuickGUIHostViewProps{Width: 240, Height: 120},
									"Account settings",
								)
							},
						)})
				},
			)
		},
	)
}

#構成

  • ui.SwiftUI.Popover.Trigger
  • ui.SwiftUI.Popover.Content

#API リファレンス

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

SwiftUIPopover.Root

ソースを見る
ui.SwiftUIPopover.Root(props SwiftUIPopoverProps, children ...any) *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)
ソースを見る
ChildrenComponent—

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

Component
ソースを見る
IsPresentedany—

Controlled native SwiftUI popover presentation state.

any
ソースを見る
OnIsPresentedChangefunc(bool)—

Reports native SwiftUI popover presentation changes.

func(bool)
ソースを見る
AttachmentAnchorstring—

Anchor point on the composed SwiftUI trigger.

string
ソースを見る
ArrowEdgestring—

Preferred edge for the native SwiftUI popover arrow.

string
ソースを見る

SwiftUIPopover.Trigger

ソースを見る
ui.SwiftUIPopover.Trigger(props SwiftUIPopoverTriggerProps) *native.Node
RenderComponent—

Callback that constructs the content for this part.

Component
ソースを見る
OnPressfunc(*native.Event)—

Runs when the native SwiftUI button is activated.

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

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

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

SwiftUIPopover.Content

ソースを見る
ui.SwiftUIPopover.Content(props SwiftUIPopoverContentProps, children ...any) *native.Node
ChildrenComponent—

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

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

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

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