WWDC21 SALE: Save 50% on all my Swift books and bundles! >>

Pushing a view without Navigation View Swift UI

Forums > SwiftUI

Hey guys. I'd like to push the view without a Navigation View. I dont want the next view to have that possibility to go back.

I've build some viewModel I do wonder how can I use it throughout this operation.

Thanks!

   

Try using .navigationBarHidden(true)

struct ContentView: View {
    var body: some View {
        NavigationView {
            NavigationLink(destination: FirstView()) {
                Text("To First View")
                    .padding()
            }
            .navigationTitle("Home")
        }
    }
}

struct FirstView: View {
    var body: some View {
        VStack {
            Text("First View")
        }
        .navigationBarHidden(true) // Use to hide back button
    }
}

   

Save money with our WWDC sale!

SAVE 50% To celebrate WWDC21, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.