Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions Sources/RemindCore/EventKitStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,24 @@ public actor RemindersStore {
}

private func fetchReminders(in calendars: [EKCalendar]) async -> [ReminderItem] {
await withCheckedContinuation { continuation in
// Capture calendar for use in closure (avoids actor isolation issues)
let cal = self.calendar
return await withCheckedContinuation { continuation in
let predicate = eventStore.predicateForReminders(in: calendars)
eventStore.fetchReminders(matching: predicate) { reminders in
// Extract all data from EKReminder objects here, before crossing isolation boundary
let mapped = (reminders ?? []).map { reminder in
self.item(from: reminder)
ReminderItem(
id: reminder.calendarItemIdentifier,
title: reminder.title ?? "",
notes: reminder.notes,
isCompleted: reminder.isCompleted,
completionDate: reminder.completionDate,
priority: ReminderPriority(eventKitValue: Int(reminder.priority)),
dueDate: reminder.dueDateComponents.flatMap { cal.date(from: $0) },
listID: reminder.calendar.calendarIdentifier,
listName: reminder.calendar.title
)
}
continuation.resume(returning: mapped)
}
Expand Down