ignoresafearea is not properly working in pro max devices using swift

Viewed 17

enter image description here

struct ContentView: View {
    var body: some View {
    
        ZStack{
            Image("background").ignoresSafeArea([.all])
        }
    }
}

tried as [.bottom,.top,..leading,.trailing]

Thanks in advance.

1 Answers

You need to add resizable modifier on your Image to resize an image to fit its space.

Image("background")
    .resizable()
    .ignoresSafeArea(.all)

If it still not covering the full screen then add aspectRatio modifier after resizable.

Image("background")
    .resizable()
    .aspectRatio(contentMode: .fill)
    .ignoresSafeArea(.all)
Related