I am having trouble fixing 3 errors

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)         }       }     }   } }

When you paste code, please use the code formatter tool (<> icon)

1. struct ModelsByCategoryGrid: View {
2. 
3.     @Binding var showBrowse: Bool
4.     let models = Models()
5. 
6.     var body: some View {
7.         VStack {
8.             // [ONE ERROR HERE SAYS "Type'(_) -> ()' cannot conform to 'View']
9.              ForEach(ModelCategory.allCases, id: .self); {
10.                  category in // [2 ERRORS HERE SAY 1: "Generic parameter 'Content' could not be inferred" 2: "Missing argument for parameter 'content' in call
11.                  //Only display the grid if the category contains items
12.                  if let modelsByCategory = models.get(category: category) {
13.                      HorizontalGrid(showbrowse: $showBrowse, title: category.label, items: modelsByCategory)
14.                  }
15.              }
16.         }
17.     }
18. }
19. 

There are several errors:

  • line 9 : .self instead of .self (see the other thread)
  • line 9: extra ; before {
I am having trouble fixing 3 errors
 
 
Q