The following works without issue.
struct ContentView: View {
enum ModelCategory: String, CaseIterable, Identifiable {
case one, two, three, four, five, six
var id: String {
self.rawValue
}
}
var body: some View {
VStack {
ForEach(ModelCategory.allCases, id: \.self) { value in
Text(value.id)
}
}
}
}
But because you have introduced a member variable that is not initialized this is the error being raised. If you have a preview snippet, pass the showBrowse param into the ModelsByCategoryGrid(showBrowse: Binding.constant(false)) or give the showBrowse a default value.
@Binding var showBrowse: Bool