bain
bain

Reputation: 355

SwiftUI Wrapping code in navigation view. Cannot view iPad sizes

In SwiftUI when I wrap all of my code in the NavigationView, I can see me UI on the iPhone screen simulator sizes but not on the iPad sizes. When I remove the NavigationView I can see everything again. Anybody know why?

Upvotes: 0

Views: 398

Answers (1)

simibac
simibac

Reputation: 8570

The navigationView is there but you need to swipe in from the left. Or in landscape, it is always visible too.

You can add .navigationViewStyle(StackNavigationViewStyle()) to make it visible all the time.

struct ContentView: View {

    var body: some View {
        NavigationView {
            Form {
                Text("Hello World")
            }
        }.navigationViewStyle(StackNavigationViewStyle())
    }
}

Upvotes: 2

Related Questions