-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPopovers.swift
40 lines (35 loc) · 969 Bytes
/
Popovers.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import SwiftUI
struct Popovers: View {
@State var isPresented: Bool = false
var body: some View {
ZStack {
Color.orange.ignoresSafeArea()
Button("Click") {
isPresented.toggle()
}
.foregroundStyle(.white)
.padding(20)
.background(
RoundedRectangle(cornerRadius: 20).background(.black)
)
.popover(
isPresented: $isPresented,
attachmentAnchor: .point(.top),
arrowEdge: .bottom
) {
ZStack {
Color.white.ignoresSafeArea()
Text("Hello")
}
.presentationCompactAdaptation(
.popover
// .sheet
// .fullScreenCover
)
}
}
}
}
#Preview {
Popovers()
}