Unexpected Transparency in .fullScreenCover(isPresented:) Background in SwiftUI iOS 18 Beta

I've encountered an issue with the .fullScreenCover(isPresented:) modifier in SwiftUI while testing on iOS 18 beta. Previously, when presenting a full-screen cover, the background was opaque with a default white color. However, in this beta version, the background now appears to be transparent by default.

This unexpected transparency is causing underlying views to be visible through the full-screen cover, which disrupts the intended user experience. To achieve the previous behavior, developers now need to manually set a background color, which was not necessary before.

@marudavid I don't believe there was a behavioral change in this API. Could you provide a code snippet that I can test to see how the behavior differs between devices running iOS 17 and the iOS 18 beta?

@marudavid I am not able to reproduce your issue using the following sample code. There is a default background color always on both Xcode 15 and Xcode 16.1 Beta. It is possible you are using some type of ViewModifier that is causing this.

The following works fine.

import SwiftUI

struct Icon: Identifiable {
    var id: String
    var color: Color
}

struct ContentView: View {
    let icons = [
        Icon(id: "figure.badminton", color: .red),
        Icon(id: "figure.fencing", color: .orange),
        Icon(id: "figure.gymnastics", color: .green),
        Icon(id: "figure.indoor.cycle", color: .blue),
        Icon(id: "figure.outdoor.cycle", color: .purple),
        Icon(id: "figure.rower", color: .indigo),
    ]

    @State private var selected: Icon?

    var body: some View {
        LazyVGrid(columns: [.init(.adaptive(minimum: 100, maximum: 300))]) {
            ForEach(icons) { icon in
                Button {
                    selected = icon
                } label: {
                    Image(systemName: icon.id)
                }
                .foregroundStyle(icon.color.gradient)
                .font(.system(size: 100))
            }
        }
         .fullScreenCover(item: $selected, content: { icon in
             DestinationView(icon: icon, animation: animation)
                 .onTapGesture {
                    selected = nil
                 }
         })
    }
}

struct DestinationView: View {
    var icon: Icon
    var animation: Namespace.ID

    var body: some View {
        Image(systemName: icon.id)
            .font(.system(size: 300))
            .foregroundStyle(icon.color.gradient)
    }
}

#Preview {
    ContentView()
}
Unexpected Transparency in .fullScreenCover(isPresented:) Background in SwiftUI iOS 18 Beta
 
 
Q