
- 팝오버는 항상 어떤 뷰나 좌표에서 표시된다. 이는
Anchor
라고 불린다.
- 여기서는 +버튼
- 아이폰에서는
Card Modal
로 대신 표시된다.
struct Popover: View {
@State private var showPopover = false
var body: some View {
Button(action: {
showPopover = true
}, label: {
})
.popover(isPresented: $showPopover, attachmentAnchor: .rect(Anchor<CGRect>.Source.bounds)) {
FormView()
}
}
}
- State var 필수
attachmentAnchor
에는 frame 혹은 source가 올 수 있다.
- 크기를 직접 입력하지 않거나 파악이 어렵다면 가장 작은 크기로 표시된다.

struct Popover: View {
...
.popover(isPresented: $showPopover) {
FormView()
.frame(minWidth: 320, minHeight: 400)
}
}
}