struct RandomizeTab: View {
var restaurantInfo = Restaurants()
var body: some View {
NavigationView {
NavigationLink(
destination: DetailView(restaurantInfo: restaurantInfo.restaurantList[Int.random(in: 0...restaurantInfo.restaurantList.count-1)]),
label: {
Text("Randomize")
.font(.title3)
.fontWeight(.bold)
.padding()
.background(Color.red)
.foregroundColor(.white)
.clipShape(Capsule())
})
}
}
}
Currently, this code chooses one random restaurant from the list and doesn't choose a new random restaurant from the list each time I tap it.