I want to have an image and the title of the image in an array so I can flip through the images with the titles. Like the recipe app.
I thought I could do this to link each image with its title
let imageArray: [[String]] = [["MM1", "memo1"], ["MM2", "memo2"], ["MM3", "memo3"]]
But I get an error with my ForEach statements
self.isDetailViewShowing = true
}, label: {
ZStack{
Rectangle()
.foregroundColor(.white)
VStack(spacing: 0){
Image(imageArray[index])
.resizable()
.aspectRatio(contentMode: /*@START_MENU_TOKEN@*/.fill/*@END_MENU_TOKEN@*/)
.clipped()
Text(imageArray[index])
.padding(5)
.font(Font.custom("Avenir", size: 15))
}
}
})
.tag(index)
I get these errors “Cannot convert value of type ‘[String]’ to expected argument type ‘String’” and "No exact matches in call to initializer "
Any thoughts?