Skip to content
Open
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
11 changes: 10 additions & 1 deletion ios/Classes/SwiftDeviceCalendarPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import Flutter
import Foundation
import UIKit

class EventStoreManager: ObservableObject {
static let shared = EventStoreManager()
let eventStore: EKEventStore
private init() {
eventStore = EKEventStore()
}
}

extension Date {
var millisecondsSinceEpoch: Double { return self.timeIntervalSince1970 * 1000.0 }
}
Expand Down Expand Up @@ -102,7 +110,7 @@ public class SwiftDeviceCalendarPlugin: NSObject, FlutterPlugin, EKEventViewDele
let calendarNotFoundErrorMessageFormat = "The calendar with the ID %@ could not be found"
let calendarReadOnlyErrorMessageFormat = "Calendar with ID %@ is read-only"
let eventNotFoundErrorMessageFormat = "The event with the ID %@ could not be found"
let eventStore = EKEventStore()
let eventStore = EventStoreManager.shared.eventStore
let requestPermissionsMethod = "requestPermissions"
let hasPermissionsMethod = "hasPermissions"
let retrieveCalendarsMethod = "retrieveCalendars"
Expand Down Expand Up @@ -1169,3 +1177,4 @@ extension UIColor {
}

}

Loading