Skip to content

Popover

Presents a native SwiftUI popover from a composed SwiftUI trigger.

#Import

Import ui from github.com/egoist/quickgui/go/ui.

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

#Usage

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",
								)
							},
						)})
				},
			)
		},
	)
}

#Anatomy

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

#API reference

Expand an entry for its description and complete signature. A dash means no declaration default is documented.

SwiftUIPopover.Root

View source
ui.SwiftUIPopover.Root(props SwiftUIPopoverProps, children ...any) *native.Node
TestIDany—

Stable identifier for native automation and tests.

any
View source
Modifiersany—

Ordered SwiftUI view modifiers applied to the hosted control.

any
View source
Reffunc(*native.Node)—

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

func(*native.Node)
View source
ChildrenComponent—

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

Component
View source
IsPresentedany—

Controlled native SwiftUI popover presentation state.

any
View source
OnIsPresentedChangefunc(bool)—

Reports native SwiftUI popover presentation changes.

func(bool)
View source
AttachmentAnchorstring—

Anchor point on the composed SwiftUI trigger.

string
View source
ArrowEdgestring—

Preferred edge for the native SwiftUI popover arrow.

string
View source

SwiftUIPopover.Trigger

View source
ui.SwiftUIPopover.Trigger(props SwiftUIPopoverTriggerProps) *native.Node
RenderComponent—

Callback that constructs the content for this part.

Component
View source
OnPressfunc(*native.Event)—

Runs when the native SwiftUI button is activated.

func(*native.Event)
View source
Reffunc(*native.Node)—

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

func(*native.Node)
View source

SwiftUIPopover.Content

View source
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
View source
Reffunc(*native.Node)—

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

func(*native.Node)
View source