0

For some reason I can't see the back button in the Navigation View.

I don't know if there is some extra code that I need to add in the child view but I don't know. I more or less copied the code from the tutorial, but I can't see the back button in the child view.

    var body: some View {
        VStack {
            //Rectangle 12
            Rectangle()
                .fill(Color(#colorLiteral(red: 0.7137255072593689, green: 0.10196077823638916, blue: 0.10196077823638916, alpha: 1)))
                .frame(width: .infinity, height: 50)
                .padding(.bottom, 0.0)
            
            
            NavigationView {
                ZStack{
                    Color(red: 0.9, green: 0.9, blue: 0.9).edgesIgnoringSafeArea(.all)
                    
                    
                    ScrollView(.vertical, showsIndicators: true) {
                        
                        HStack{
                            Text("Marketplace").font(.custom("Arial", size: 35))
                                .fontWeight(.medium)
                                .foregroundColor(Color(red: 0.1, green: 0.1, blue: 0.1))
                                .padding(EdgeInsets(top: 15, leading: 20, bottom: -2, trailing: 0))

                            Spacer()
                        }
                
                        ForEach(produitsdfsdf, id: \.id ) { product in
                            
                            NavigationLink(destination: TempView()) {
                                LandingPresets.listItem(name: product.name, description: product.price, rate: product.category)
                            }
                        }
                        
                    }
                    .navigationBarHidden(true)
                    
                }
            }
            .padding(.top, -8.0)
            
            
        }.ignoresSafeArea(edges: .top)
            .onAppear {
                ProductAPI().getAllProducts {(productArr) in
                    self.produitsdfsdf = productArr
                }
            }
        
        
    }

1 Answers1

0

It is because of you use .navigationBarHidden(true) in main View. You could add .navigationBarTitleDisplayMode(.inline) to your TempView(). If you give code of TempView, I'll be able to show to which part of code.