Shumaila
0
Q:

add navigation bar button swiftui

.navigationBarItems(
    leading: Button(action: {
        // Actions
    }, label: { Text("Button") }),

    trailing: Button(action: {
    // Actions
    }, label: { Image("Icon") })
)
3
ForEach (self.drinks, id: \.name)
{
  drink in

  //detail: The SwiftUI view you want to go to
  NavigationLink(destination: DrinkDetail(drink: drink))
  {
    //the button/image you click on to go to that view
    DrinkItem(drink: drink)
    .frame(width: 300)
    .padding(.trailing, 30)
    
    
  }

}
0

New to Communities?

Join the community