4

I'm using this code to hide a navigation bar and Back button but when the view is loaded i still can see the back button for a fraction of second and then it disappears. Is there any way to prevent it from being shown?

var body: some View {
    NavigationView {
        NavigationLink(destination: DeferView { WeekView(journey: self.launcher.completeJourney!) }, isActive: self.$launcher.readyJourney ) { EmptyView () }
        .navigationBarHidden(true)
        .navigationBarTitle("")
    }
}

Thank you in advance,

eugene_prg
  • 948
  • 2
  • 12
  • 25

1 Answers1

4

Add the same modifiers also for link destination,

var body: some View {
    NavigationView {
        NavigationLink(destination: DeferView { WeekView(journey: self.launcher.completeJourney!) }
                                    .navigationBarHidden(true)   // here !!
                                    .navigationBarTitle("")      // here !!

              , isActive: self.$launcher.readyJourney ) { EmptyView () }
        .navigationBarHidden(true)
        .navigationBarTitle("")
    }
}
Asperi
  • 228,894
  • 20
  • 464
  • 690
  • This doesn't work for me do you have any other suggestion? My code: struct FirstSwiftUIView: View { var body: some View { VStack { Text("First SwiftUi View") NavigationLink { SecondSwiftUIView() } label: { Text("Next View") } } .navigationBarBackButtonHidden(true) .navigationBarTitle("") } } – Bhuvan Bhatt Feb 01 '22 at 16:19