First off, thank you so much for this, it is awesome and amazing work.
I am encountering a bug when trying to ForEach through the results of a SectionedQuery.
My model is simple (ish), I do have a couple relations in there though...
@Model
class FoodItem: Hashable {
var calories: Int
var dateString: String
var image: String
var mealType: String
var name: String
var timestamp: Int64
@Relationship(deleteRule: .cascade) var foodItems: [ItemsInMeal] = []
@Relationship(deleteRule: .cascade) var nutrition: Nutrition?
init(...) {
...
}
}
Then in my view...
struct FilteredMeals: View {
@Environment(\.modelContext) var modelContext
@SectionedQuery var items: SectionedResults<String, FoodItem>
var filter: String
@State private var newSelection: Set<String> = []
init(filter: String) {
self.filter = filter
_items = SectionedQuery(
\.dateString,
filter: #Predicate<FoodItem> { item in
item.name.starts(with: filter)
}
)
}
var body: some View {
NavigationStack {
List {
ForEach(items) { item in
Section {
if newSelection.contains("\(item.id)") {
ForEach(item) { food in //This is where the error is
NavigationLink { ... } label: { ... }
}
}
} header: { ... }
}
}
}
}
}
In case it's not obvious in the code the Error shows up in the ForEach(item) { food in ... Area. Generic parameter 'V' could not be inferred.
Not sure why this would be the case, but it won't allow me to ForEach inside the section
First off, thank you so much for this, it is awesome and amazing work.
I am encountering a bug when trying to ForEach through the results of a SectionedQuery.
My model is simple (ish), I do have a couple relations in there though...
Then in my view...
In case it's not obvious in the code the Error shows up in the
ForEach(item) { food in ...Area. Generic parameter 'V' could not be inferred.Not sure why this would be the case, but it won't allow me to ForEach inside the section