Created
November 19, 2023 21:21
-
-
Save colinfwren/83307e89a055fbf99de905278ad77aee to your computer and use it in GitHub Desktop.
Date Test Approach 1 fetchMonthData
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func fetchMonthData() { | |
do { | |
let descriptor = FetchDescriptor<ApproachModel>(predicate: #Predicate { todo in | |
((todo.startDate >= startDate && todo.startDate <= endDate) || (todo.endDate >= startDate && todo.endDate <= endDate)) && todo.shownInWeek == true | |
}, sortBy: [SortDescriptor(\.endDate)]) | |
todos = try modelContext.fetch(descriptor) | |
} catch { | |
print("Failed to fetch month data") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment