Now Playing
Attached to the control that opened it — note the anchor arrow.
The bubble with the arrow is an NSPopover — click the button to toggle it
Popover
/ NSPopover · NSPopover.show(relativeTo:of:preferredEdge:) /
also called anchored popover, popover bubble, callout
A popover is a lightweight floating bubble for controls or information related to one specific source view. Its arrow identifies the control that opened it, and AppKit chooses an edge that keeps the bubble onscreen. Depending on its behavior, it can close when the user interacts elsewhere or remain open until dismissed explicitly.
If you called it…
…you meant a popover.
Anatomy — every part, named
- 1Anchor arrow
NSPopover.show(relativeTo:of:preferredEdge:)“The little point on the bubble aimed at the button” is the anchor arrow. A classic bug in custom popovers is an arrow that reads as a separate triangle stuck onto the bubble — it must share the bubble's exact background and mask the border where they meet.
- 2Positioning rect
NSPopover.show(relativeTo:of:preferredEdge:)“The exact bit of the button the bubble attaches to” is the positioning rect.
Prompt — paste into your agent
Present this as a Popover using NSPopover (SwiftUI: View.popover), with a visible anchor arrow aimed at the exact control that opened it. The arrow must share the bubble's exact background and blend seamlessly into it, never read as a separate triangle. It should remain visually attached to that control and dismiss with native popover behavior.
Debug prompt — when it misbehaves
Paste this, then describe what you’re seeing — it hands your agent the classic failure modes to rule out first.
Debug my macOS popover (NSPopover, SwiftUI View.popover). Rule out: transient behavior closing it on the first click inside custom content that does not accept first responder; the arrow anchored to a stale positioning rect after layout changes; a custom-drawn anchor arrow reading as a detached triangle because it is painted under the bubble's border or shadow or with a mismatched fill; the popover detaching into a floating window when dragged (detachable delegate); SwiftUI popovers presenting as sheets in compact contexts. The symptom:
In code
The exact names this thing goes by in code — each row is one framework’s word for it. Use the row that matches your project (or paste it into your prompt).
| AppKit | NSPopover | |
| AppKit | NSPopover.show(relativeTo:of:preferredEdge:) | positions the popover and its anchor arrow |
| SwiftUI | View.popover(isPresented:attachmentAnchor:arrowEdge:content:) | |
| AppKit | NSPopover.Behavior |