I'm building a ViewModifier that looks like iOS alerts, except it's able to not have any buttons/actions on the popup. My main concern is that I'm using .overlay {}
to show this alert on my content
with a .opacity(isPresented ? 1 : 0)
modifier. This alert would have a ProgressView()
on it and I don't want SwiftUI to always be animating that ProgressView()
behind the scenes.
I tried putting Color.black.opacity(isPresented ? 1 : 0).allowsHitTesting(false)
on top of my content with .overlay
and when the opacity was 0 it allowed me to tap any of the content that the Color.black
would've been on top of, but when isPresented
was true
it didn't allow me to tap any of it. This seems like good enough evidence to me that it doesn't compute views with 0 opacities, but I was curious if anyone had any other insight.