0

I want to set the color of my navigation bar so that it matches my other screens. But I have a List View component that won't let me set the navigation bar color.

Here is my code;

struct DetailsView: View {
    
    var viewModel: ViewModel
    
    var body: some View {
        
        List(viewModel.drinks.drinks) { cocktail in
            VStack(alignment: .center) {
                HStack(alignment: .center) {
                    Text(cocktail.strDrink + "  -")
                        .frame(alignment: .center)
                    Text(cocktail.strAlcoholic)
                        .frame(alignment: .center)
                }
                
                WebImage(url: URL(string: cocktail.strDrinkThumb))
                    .resizable()
                    .frame(width: UIScreen.main.bounds.width - 20.0, height: UIScreen.main.bounds.width - 20.0, alignment: .center)
                
                
                Text("~ Ingredients List ~\n").frame(alignment: .center)
                
                ForEach(viewModel.buildIngredients(cocktail), id: \.self) { ingredient in
                    Text(ingredient)
                }
                
                Text("\n~ Recipe Instructions ~\n\n")
                
                Text(cocktail.strInstructions + "\n").fixedSize(horizontal: false, vertical: true)
            }
            
        }
        .foregroundColor(Color.blue)
    }
}

This is what i see

  • Does this answer your question? [How to change navigationBar background color locally](https://stackoverflow.com/questions/65404191/how-to-change-navigationbar-background-color-locally) – lorem ipsum Nov 03 '21 at 17:10

0 Answers0