0

I've written an app in Swift 5 using XCode 12.2

The app and all it's functionalities work on the following simulators: iPhone 8, iPhone SE 2nd Gen, iPhone 11 Pro, iPhone 12, iPhone 12 Pro, and iPhone 12 Mini

The issue occurs on all iPads, iPhone 8 plus, iPhone 11, iPhone 11 Pro Max, and iPhone 12 Pro Max.

I'm not sure what to make of this and am considering submitting a bug report/TSI, but I wanted to make sure there wasn't an obvious issue with my design.

Below is the structure of my content view. I removed things I though were extraneous to try to concisely illustrate the structure. I've also attached images of the properly running initial view vs the failing one.Proper Opening Screen, Problem opening Screen. I also ran it on a real iPhone SE 2nd gen and iPhone 8 and got the same results. Thanks in advance.

struct ContentView: View {
//@State vars
    var body: some View {
        NavigationView{
            ZStack{
                Image("image")
                VStack{
                    Spacer()
                    HStack{
                        Text("text")
                            .bold()
                            .foregroundColor(.white)
                            .font(.largeTitle)
                        Image("image2")
                    }.offset(y:10)
                    Form {
                        Section(header: Text("INITILIZATION SETTINGS")){
                            TextField("t1", text: $t1)
                            TextField("t2", text: $t2)
                            Stepper(value: $s1, in: 1...240){
                                Text("s1: \(s1)").onChange(of: s1, perform: { value in
                                    playSound(sound: "sound1", volume: 0.3)
                                })
                            }
                        }
                    }.frame(minWidth: 0, idealWidth: 400, maxWidth:400, minHeight: 0, idealHeight: 100, maxHeight: 180, alignment: .center).border(Color.black, width: 7)
                    VStack()
                    {
                        NavigationLink(destination: otherView().onAppear{playSound(sound: "sound2")}, label: {
                            Text("label")
                        }).padding().background(Color.white).border(Color.black, width: 2).cornerRadius(3.0)

                        NavigationLink(destination: otherView2()) {
                            Text("label2").padding(5).background(Color.white).border(Color.black, width: 2).cornerRadius(3.0).offset(y:-5)
                        }
                    }
                    Spacer()
                }
            }
        }.navigationBarTitle("").navigationBarHidden(true)
    }
}

1 Answers1

1

The solution was very simple and a matter of settings. Answer at ~29 mins in this Hacking With Swift video [https://youtu.be/nA6Jo6YnL9g?t=1720][1].

Large screen iOS devices automatically split the screen into multiple views with default navigationView{} settings. I don't know what the blank screen was about, but this fixed the problem Simply add view modifier .navigationViewStyle(StackNavigationViewStyle())

I figured I'd self-answer instead of deleting the post because I had a lot of trouble finding solutions on the web! Hopefully this will be helpful to someone!