3

I can't understand how to solve this problem... I want to show a different layout only when my app is opened in 2/3 Split View on iPad...here's some images to let you understand better...

This is the correct layout when the app is in full screen: enter image description here

This is the correct layout when the app is in 1/2 Split View: enter image description here

This is the correct layout when the app is in 1/3 Split View: enter image description here

This is the WRONG layout when the app is in 2/3 Split View: enter image description here

The problem is that the text that is visible when the app is in 1/2 Split View, has to be visible also when the app is in 2/3 Split View...

At the moment, the code is this:

GeometryReader { geometry in
    if geometry.size.height > geometry.size.width && sizeClass == .compact { // OK
        VStack(alignment: .center) {
            Text("Per mostrare la barra laterale")
                .font(.title)
                .foregroundColor(.gray)
            Text("scorri dal lato sinistro,")
                .font(.title)
                .foregroundColor(.gray)
            Text("poi seleziona una categoria")
                .font(.title)
                .foregroundColor(.gray)
        }
        .frame(width: geometry.size.width, height: geometry.size.height)
    } else if geometry.size.height > geometry.size.width && sizeClass == .regular { // OK
        VStack(alignment: .center) {
            Text("Per mostrare la barra laterale")
                .font(.title)
                .foregroundColor(.gray)
            Text("scorri dal lato sinistro,")
                .font(.title)
                .foregroundColor(.gray)
            Text("poi seleziona una categoria")
                .font(.title)
                .foregroundColor(.gray)
        }
        .frame(width: geometry.size.width, height: geometry.size.height)
    } else if geometry.size.height < geometry.size.width && sizeClass == .regular { // OK in full screen, not in 2/3
        VStack(alignment: .center) {
            Text("Seleziona una categoria")
                .font(.title)
                .foregroundColor(.gray)
            Text("dalla barra laterale")
                .font(.title)
                .foregroundColor(.gray)
        }
        .frame(width: geometry.size.width, height: geometry.size.height)
    }
}

Is there any way to solve this? Any help is appreciated...thanks!

0 Answers0