struct ModelsByCategoryGrid: View {
2. @Binding var showBrowse: Bool
3. let models = Models()
4. var body: some View {
5. VStack { ForEach(ModelCategory.allCases, id: \.self) { category in
//Only display the grid if the category contains items
7. if let modelsByCategory = models.get(category: category) {
8. HorizontalGrid(showbrowse: $showBrowse, title: category.label, items: modelsByCategory)
}
I GET AN ERROR FOR LINE 5 SAYING "MISSING ARGUMENT FOR PARAMETER IN #1 CALL"
Post
Replies
Boosts
Views
Activity
ForEach(ModelCategory.allCases, id: .self) { category in
The error message says "Missing argument for parameter #1 in call"
How do I fix this?
var body: some View {
VStack {
ForEach(ModelCategory.allCases, id: .self) { category in [The error occurs for this ForEach command and it says: "Missing argument for parameter #1 in call"]
//Only display the grid if the category contains items
if let modelsByCategory = models.get(category: category) {
HorizontalGrid(showbrowse: $showBrowse, title: category.label, items: modelsByCategory)
}
}
}
}
struct ModelsByCategoryGrid: View {
@Binding var showBrowse: Bool
let models = Models()
var body: some View {
VStack { [ONE ERROR HERE SAYS "Type'(_) -> ()' cannot conform to 'View']
ForEach(ModelCategory.allCases, id: .self); { category in [2 ERRORS HERE SAY 1: "Generic parameter 'Content' could not be inferred" 2: "Missing argument for parameter 'content' in call
//Only display the grid if the category contains items
if let modelsByCategory = models.get(category: category) {
HorizontalGrid(showbrowse: $showBrowse, title: category.label, items: modelsByCategory)
}
}
}
}
}