(ForEach-Error)SwiftUI, Firestore getting one collection and matching with another

I am so confused with linking one collection to another (Foreach)

I want my artwork to be displayed in that exhibition. if collection: exhibition.id = collection: artwork.exhbtid show: infomation artwork (Infoview)

Any feedback would be appreciated. Thanks

Edit: now i found error I don't know what to do, Could you advise me

ForEach<Array, String, Optional<NavigationLink<ArtworkInfoCard, ArtworkInfoView>>>: the ID 1 occurs multiple times within the collection, this will give undefined results!

ForEach<Array, String, Optional<NavigationLink<ArtworkInfoCard, ArtworkInfoView>>>: the ID 1 occurs multiple times within the collection, this will give undefined results!

ForEach<Array, String, ForEach<Array, String, Optional<NavigationLink<ArtworkInfoCard, ArtworkInfoView>>>>: the ID 2 occurs multiple times within the collection, this will give undefined results!

ForEach<Array, String, ForEach<Array, String, Optional<NavigationLink<ArtworkInfoCard, ArtworkInfoView>>>>: the ID 1 occurs multiple times within the collection, this will give undefined results!

LazyVGridLayout: the ID UniqueID(value: 4196) is used by multiple child views, this will give undefined results!

Code:

Exhibition Model:

Exhibition ViewModel:

Artwork Model:

Artwork ViewModel:

Hello. I'll try to address the error reported by the compiler first. As stated on Apple List documentation the List type should conform to Identifiable. This is done as SwiftUI needs to know how to identify each and every cell in our list in order to optimize it and perform any operation like displaying, removing cells.

That being said it seems by the error you reported that multiple cells have the same id. This is not acceptable since by design the id needs to be different for each cell. This is so SwiftUI can understand which cell is which. I would advise to double-check that the id is different in each Artwork type.

In the example below we assign a new unique UUID so that it's almost fully guaranteed that each cell have a different id:

struct Artwork: Identifiable {
    let id = UUID()
}

I tried to do what was suggested from MarcoCarnevali (Thank you very much for your help.), But the program still doesn't work as I want. Any feedback would be appreciated. Thanks

@srthploid, what's the error (if any) reported by the compiler?

(ForEach-Error)SwiftUI, Firestore getting one collection and matching with another
 
 
Q