<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/popover(isPresented:attachmentAnchor:arrowEdge:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE7popover11isPresented16attachmentAnchor9arrowEdge7contentQrAA7BindingVySbG_AA017PopoverAttachmentH0OAA0J0OSgqd__yctAaBRd__lF"
  },
  "title" : "popover(isPresented:attachmentAnchor:arrowEdge:content:)"
}
-->

# popover(isPresented:attachmentAnchor:arrowEdge:content:)

Presents a popover when a given condition is true.

```
@export(implementation) nonisolated func popover<Content>(isPresented: Binding<Bool>, attachmentAnchor: PopoverAttachmentAnchor = .rect(.bounds), arrowEdge: Edge? = nil, @ContentBuilder content: @escaping () -> Content) -> some View where Content : View
```

## Parameters

`isPresented`

A binding to a Boolean value that determines whether
to present the popover content that you return from the modifier’s
`content` closure.

`attachmentAnchor`

The positioning anchor that defines the
attachment point of the popover. The default is
[`bounds`](/documentation/SwiftUI/Anchor/Source/bounds).

`arrowEdge`

The edge of the `attachmentAnchor` that defines the
location of the popover’s arrow. The default is `nil`, which results in the system allowing
any arrow edge.

`content`

A closure returning the content of the popover.

## Discussion

Use this method to show a popover with contents that are a SwiftUI view, which you provide when
a bound Boolean variable is `true`. In the example below, a popover displays whenever the user
toggles the `isShowingPopover` state variable by pressing the “Show Popover” button:

```swift
struct PopoverExample: View {
    @State private var isShowingPopover = false

    var body: some View {
        Button("Show Popover") {
            self.isShowingPopover = true
        }
        .popover(isPresented: $isShowingPopover) {
            Text("Popover Content")
                .padding()
        }
    }
}
```

![A screenshot showing a popover that says Popover Content hovering](images/com.apple.SwiftUI/View-popover-1@2x.png)

> Important: Prior to iOS 18.1, the popover arrow edge was not
> respected. Apps that are re-compiled with the iOS 18.1 or later SDK or
> visionOS 2.1 or later SDK and run on iOS 18.1 or later or visionOS 2.1
> or later have the arrow edge respected. On macOS, arrow edge has always
> been respected. Alternatively, to allow the system to choose the
> best orientation of the popover’s arrow, use the
> ``View/popover(isPresented:attachmentAnchor:content:)`` variant.

On iPhone, popovers adapt into sheets. In vertically compact environments, such as iPhone in
landscape orientation, a popover presentation automatically adapts to appear as a
full-screen cover. Use the [`presentationCompactAdaptation(_:)`](/documentation/SwiftUI/View/presentationCompactAdaptation(_:)) or
[`presentationCompactAdaptation(horizontal:vertical:)`](/documentation/SwiftUI/View/presentationCompactAdaptation(horizontal:vertical:)) modifier to
override this behavior.

### Breakthrough effect

In visionOS, most system presentations appear with a breakthrough effect by
default. To change how the enclosing presentation breaks through
content occluding it, use [`presentationBreakthroughEffect(_:)`](/documentation/SwiftUI/View/presentationBreakthroughEffect(_:)),
like in the following example:

```swift
.popover(isPresented: $isShowingPopover) {
    Text("Popover Content")
        .padding()
        .presentationBreakthroughEffect(.prominent)
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)