Home > Blockchain >  ignoreSafeArea(.all,edge:.all) is not working in IOS 16
ignoreSafeArea(.all,edge:.all) is not working in IOS 16

Time:09-26

I tried so many ways but it's not working. Please, anyone facing the same issue after updating ios 16, or xcode version, or iPhone 14 Simulator

Please, if you are facing the same problem, let me know.  My old project is working fine, but the new one that I created on it is not working.

any solution on it

ZStack {
    Color("BlueColor")
      .ignoresSafeArea(.all, edge:.all)
}

CodePudding user response:

Not sure what you are trying to achieve, but the code provided looks and behaves the same on iOS 15 and iOS 16.

I assume you want Color("BlueColor") to fill the entire background? That works perfectly fine, but for some reason your ContentView you wrap your views in a VStack and apply a .padding

Simply remove the VStack

struct ContentView: View {
    @AppStorage("onBoarding") var isOnBoarding = true
    
    var body: some View {
        if isOnBoarding {
            OnboardingView()
        } else {
            Text("Home")
        }
    }
}

or if for some reason you need said VStack at least remove the padding

struct ContentView: View {
    @AppStorage("onBoarding") var isOnBoarding = true
    
    var body: some View {
        VStack {
            if isOnBoarding {
                OnboardingView()
            } else {
                Text("Home")
            }
        }
    }
}
  • Related