Skip to content

Commit

Permalink
Changes to @published events setter should be on main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
vinhnx authored Dec 23, 2020
1 parent 304b4d3 commit 532f97d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Shift/Shift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ public final class Shift: ObservableObject {
let calendars = self.eventStore.calendars(for: .event)
let predicate = self.eventStore.predicateForEvents(withStart: startDate, end: endDate, calendars: calendars)
let events = self.eventStore.events(matching: predicate)
self.events = events
DispatchQueue.main.async { completion?(.success(events)) }
DispatchQueue.main.async {
self.events = events
completion?(.success(events))
}

case let .failure(error):
DispatchQueue.main.async {
Expand Down

0 comments on commit 532f97d

Please sign in to comment.