Possible to set body view's background to transparent?

Please see screenshot. Currently the one in white has an animation in the middle. i wish to set the background of the body's view to transparent so that only the animation from my app is visible (it's like the home screen but only my animation is shown when the app is run.

Is that possible? I tried to set VStack's background color opacity to 0 but nothing happpens.

Or is it something else that needs to be modified?

Thoughts?

Replies

Put the whole body content in a ZStack and set its background clear:

struct MyView: View {
    var body: some View {
        
        ZStack {
              // The view content 
         }
         .background(.clear)
}
  • lol. .clear, i didnt expect that keyword . thanks claude31!

  • @Claude31 it didnt work out though. the background of the view is all white.

Add a Comment