ignoresSafeArea working on preview but not simulator

I am currently getting to grips with Xcode, one issue that I am having with all projects I work on is the .ignoresSafeArea does not work when I run the project on the simulator, regardless of which iPhone I use, even though it is displayed perfectly fine in the preview, I have attached a screenshot of a bare project incase that is of any use. I am new to Xcode so it is highly likely that I am making a simple rookie mistake but any advice would be much appreciated!

Weird, I tried your code and it worked in the simulator (iOS 17.2, Xcode 15.1). One thing I thought about was that if you have any view in your RandomTestingFeaturesApp.swift file that fights with your ContentView.

Like if you have this code:

struct TestApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .padding() // <- padding which limits contentview to not reach all safe area
        }
    }
}

struct ContentView: View {
    let mainColor = Color.green
    var body: some View {
        ZStack {
            mainColor.ignoresSafeArea(.all)
            Text("Hello world!")
                .padding()
        }
    }
}

With and without padding in the TestApp app struct:

To sum, please check your main app struct in the RandomTestingFeaturesApp.swift file, and have a great day!

Thank you for your reply it was really helpful to know that my code works above all else, Ive checked the main app structure in the file and there is no padding in there and yet the problem persists, I'll continue to have a look/play around and see if I can get it to work. Thank you again for taking the time to advise and help out, have a great day!

ignoresSafeArea working on preview but not simulator
 
 
Q