iOS 15 safe area background color unexpected change

Hello everyone. I have encountered a strange bug when working with iOS version checking in SwiftUI. If I use the iOS version checking for a view and the respective view makes direct contact with a safe area border, the background color of the zone outside of that border will be the background color of that view. This appears to happen only on iOS 15 devices(I experimented on an iPhone 11 simulator). The following code is an example of such behaviour:

struct ContentView: View {
    var body: some View {
            if #available(iOS 15.0, *) {
                Color.red
                    .background(Color.blue)
            } else {
                Color.red
                    .background(Color.blue)
            }
    }
}

In this case normally the entire screen should be red and the color of the zone outside of the safe area should be the default one. However if I run this code on an iOS 15 device, the background color of the zone outside the safe area will be blue. If I would change the code with something like this:

struct ContentView: View {
    var body: some View {
        VStack {
            Text("SwiftUI")
            if #available(iOS 15.0, *) {
                Color.red
            } else {
                Color.red
            }
            Text("Combine")
        }
        .background(Color.blue)
    }
}

the background color of the zone outside the safe area would be the normal one. Also if I remove the version check in the first case, the app would run normally as well. A solution I found is to incorporate the view inside a container and add a padding of 1. Is there a better solution for such cases?

iOS 15 safe area background color unexpected change
 
 
Q