I have list image and when I click the image list items it show me image details, but it show same image even I click the different image? any idea?
Datas:
struct Datas: Identifiable {
var id = UUID().uuidString
var name: String
var detail: String
var image: String
}
var datas = [
Datas(name: "People1.jpg"),
Datas(name: "People.2jpg"),
Datas(name: "People3.jpg"),
]
RowView:
struct RowView: View {
var docs: Datas
var body: some View {
NavigationLink(destination: ListDetailsView(docs: datas[0])) {
Image(docs.image)
.resizable()
.frame(width: 64, height: 48)
}
}
ListDetailsView:
struct ListDetailsView: View {
var docs: Datas
var body: some View {
ZStack{
Image(docs.image)
}
}
}
struct ListDetailsView_Previews: PreviewProvider {
static var previews: some View {
ListDetailsView(docs: datas[0])
}
}