1) I want to show data from multiple arrays (the data is identically made, just split into different arrays). How do I do this?
2) I want to show only specific selections from across the arrays.
I have created a form of ID in these arrays called "groupid: Int" which appears across the arrays. In this case, I want to extract all the entries with "groupid: 1" from multiple arrays and show them in a list.
// The view that I want to show the final list in:
import SwiftUI
struct French1View : View {
var body: some View {
NavigationView {
List {
ForEach(XXXXX????) { grape in
GrapeCell(grape: grape)
}
.navigationBarTitle("French wine grapes")
}
}
}
}
// The arrays:
let BGrapes = [
Grape(id: 1,
groupid: 1,
name: "Barbera",
type: "White"),
Grape(id: 2,
groupid: 2,
name: "Bosco",
type: "Red")
]
let CGrapes = [
Grape(id: 1,
groupid: 1,
name: "Barbera",
type: "White")
]
As you can see in the code, I am stuck on what I should enter where I have (for this example) written "XXXXX????"
I have tried writing "(BGrapes, CGrapes) && grape.groupid(1)" but without success.

