Hello!
I was wondering if there's any open source example how to implement SUBQUERY in CoreData in calendar based app? For example:
- User creates an event with subtasks on the 1st on September with daily frequency
- On the 5th of September they update just that day event's details, some subtasks.
- On the 7th of September they see the same event that was created on the 1st of September.
Structs that can describe the case may look like this:
enum Frequency {
case daily
case weekly
case monthly
}
struct Subtask {
var name: String
var isCompleted: Bool
}
struct Event {
var id: UUID
var name: String
var startAt: Date
var repeatUntil: Date?
var isCompleted: Bool
var subtasks: [Subtask]
var frequency: Frequency?
var excludedOn: [Date]
}
For each day on a week I need to fetch events from CoreData, so I'm wondering how predicate can look like in such case?
I met SUBQUERY, but I'm not sure how to apply weekly and monthly frequency frequency into NSPredicate (for daily it's pretty straightforward).
Would be glad for any advices!
~Paul