I receive an error “Missing argument for parameter ‘breakfasts’ in call”.
Does anyone know where am I do wrong?
Thank you.
struct BreakfastView: View {
@Environment(\.presentationMode) var mode: Binding<PresentationMode>
var breakfasts: Breakfast
var body: some View {
List() {
HStack(spacing: 20.0) {
Image(breakfasts.image)
.resizable()
.scaledToFill()
.frame(width: 40, height: 40, alignment: .center)
.clipped()
.cornerRadius(5)
Text(breakfasts.name)
}
}
.navigationBarTitle("All Recipes",displayMode: .inline)
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: Button(action : {
self.mode.wrappedValue.dismiss()
}){
Image(systemName: "arrow.left")
.foregroundColor(.black)
})
}
}
struct BreakfastView_Previews: PreviewProvider {
static var previews: some View {
BreakfastView()
}
}
struct Breakfast: Identifiable {
var id = UUID().uuidString
var name:String
var image:String
var description:String
var servings:String
var ingredients:[String]
var directions:[String]
}
var breakfasts = [
Breakfast(name: "Beef Chow Fun",image: "beef chow fun", description: "5 Miles Away", servings: "2", ingredients:[
"500g flat rice noodles",
"150g beef",
"1/2 onion",
"120g bean sprouts",
"2 tablespoons of light soy sauce",
"1 tablespoon dark soy sauce",
"1/2 teaspoon salt",
"1 teaspoon sugar",
"Marinades: 2 1/2 teaspoons light soy sauce, 1/4 teaspoon dark soy sauce, 1 teaspoon corn flour, 3/4 teaspoon sugar, 2 teaspoons water, 1/2 teaspoon sesame oil"
], directions: ["Wash the beef first and drain the water. Cut into thin slices horizontally, marinate in the marinade for about 15 minutes, set aside.",
"Heat the oil in a wok, pan-fried the beef on both sides over medium-high heat until it is eighty mature, and then set aside.",
"Heat the wok again, add onions and fry until soft. Add the bean sprouts and stir-fry until cooked, add the flat rice noodles into wok, stir-fry all the ingredients well. Add the seasonings and stir well. Finally, pour the beef and mix well. Serve."] )
]