ios – .edgesIgnoringSafeArea(.prime) causes web page content material to shrink

0
37


I am making a full-page vertical scroll like TikTok.

I am ready to take action utilizing the next code:

struct ViewA: View {
    let colours: [Color] = [ .red, .green, .blue, .gray ]

    var physique: some View {
        GeometryReader { proxy in
            TabView {
                ForEach(colours, id: .self) { colour in
                    ZStack {
                        colour
                        VStack {
                            Textual content("Hi there World")
                        }
                    }
                }
                .rotationEffect(.levels(-90))
                .body(
                    width: proxy.measurement.width,
                    top: proxy.measurement.top
                )
            }
            .body(
                width: proxy.measurement.top,
                top: proxy.measurement.width
            )
            .rotationEffect(.levels(90), anchor: .topLeading)
            .offset(x: proxy.measurement.width)
            .tabViewStyle(
                PageTabViewStyle(indexDisplayMode: .by no means)
            )
        }
    }
}

preview

Nonetheless, after I take away the highest protected space(make the content material fill all the display together with protected space) utilizing .edgesIgnoringSafeArea(.prime), my content material shrinks in width a bit.

var physique: some View {
    GeometryReader { proxy in
        TabView {
            ForEach(colours, id: .self) { colour in
                ZStack {
                    colour
                    VStack {
                        Textual content("Hi there World")
                    }
                }
            }
            .rotationEffect(.levels(-90))
            .body(
                width: proxy.measurement.width,
                top: proxy.measurement.top
            )
        }
        .body(
            width: proxy.measurement.top,
            top: proxy.measurement.width
        )
        .rotationEffect(.levels(90), anchor: .topLeading)
        .offset(x: proxy.measurement.width)
        .tabViewStyle(
            PageTabViewStyle(indexDisplayMode: .by no means)
        )
    }
    .edgesIgnoringSafeArea(.prime) <----- This line causes the issue
}

preview

I am very new to native ios improvement please assist. TIA~!