Skip to content

Instantly share code, notes, and snippets.

@colinfwren
Created November 19, 2023 21:19
Show Gist options
  • Save colinfwren/43210c3e850fc56399100a88eff24b9a to your computer and use it in GitHub Desktop.
Save colinfwren/43210c3e850fc56399100a88eff24b9a to your computer and use it in GitHub Desktop.
Date Test Approach 1 fetchWeekData implementation
func fetchWeekData() {
do {
let descriptor = FetchDescriptor<ApproachModel>(predicate: #Predicate { todo in
todo.startDate >= startDate && todo.endDate <= endDate && todo.shownInWeek == true
}, sortBy: [SortDescriptor(\.endDate)])
todos = try modelContext.fetch(descriptor)
} catch {
print("Failed to fetch week data")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment