I need to push a modal view from a button inside a view component, but should only be covering the bottom half of the screen height, the top half a semi transparent background(black with opacity 30%). Setting the opacity for the topmost view inside the fullscreenCover view builder doesnt work. Any help would be appreciated.
struct ContentView: View {
@State var present: Bool = false
var body: some View {
VStack(spacing: 20) {
Button(action: {
present = true
}, label: {
Text("spawn translucent modal")
})
.fullScreenCover(isPresented: $present) {
VStack(spacing: 20) {
Spacer()
.frame(maxWidth: .infinity, minHeight: 100)
.background(Color.black)
.opacity(0.3)
Text("modal")
}
.background(Color.clear)
}
Text("some content")
Text("some more content")
}
}
}