Skip to main content

Verfeinerte Popover-Positionierung

Demonstriert eine verfeinerte Popover-Positionierung mithilfe von attachmentAnchor und arrowEdge.

import SwiftUI

struct ContentView: View {
    @State private var showPopover = false

    var body: some View {
        Button("Show Info") {
            showPopover.toggle()
        }
        .popover(
            isPresented: $showPopover,
            attachmentAnchor: .point(.bottom),
            arrowEdge: .top
        ) {
            Text("This is additional information in a popover.")
                .padding()
                .frame(width: 200)
        }
        .padding()
    }
}