This is what I want to achieve:
I tried embeding the VStack
in another VStack
with a .background(.gray.opacity(90))
but it didn't do anything. I am using a fullScreenCover
:
let width = UIScreen.main.bounds.width
.fullScreenCover(isPresented: $showCover) {
BuyWithPointsView(type: type).frame(width: (width * (91.733 / 100)), height: (width * (66.667 / 100)))
}
EDIT: I tried implementing this answer: SwiftUI: Translucent background for fullScreenCover
.fullScreenCover(isPresented: $showCover) {
ZStack {
ZStack {
Color.gray.opacity(0.1).edgesIgnoringSafeArea(.all)
}.background(BackgroundBlurView())
BuyWithPointsView(type: type).frame(width: (width * (91.733 / 100)), height: (width * (66.667 / 100)))
}
}
struct BackgroundBlurView: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
let view = UIVisualEffectView(effect: UIBlurEffect(style: .light))
DispatchQueue.main.async {
view.superview?.superview?.backgroundColor = .clear
}
return view
}
func updateUIView(_ uiView: UIView, context: Context) {}
}
This lead to this result: However this result does not really make the background see through like I want it to be. Changing the opacity and color didn't do much.