I have a problem when try to pass data from one view to another view, it is throw an error for
ImageDetails()
as a "Missing argument for parameter 'data' in call" I do not know what I missed?
struct ImageModel: Identifiable, Hashable {
var id = UUID().uuidString
var name: String
}
var datas = [
ImageModel(name: "davis"),
]
struct ImageRowView: View {
var data: ImageModel
var body: some View {
NavigationLink(destination: ImageDetailsView(data: ImageModel)){
HStack{}
}}}
struct ImageDetailsView: View {
var body: some View {
ImageDetails()
}
}
struct ImageDetailsView_Previews: PreviewProvider {
static var previews: some View {
ImageDetailsView()
}
}
struct ImageDetails : View {
var data: ImageModel
var body: some View{
VStack{
Text(data.name)
}
}