From 4298917497c8bead5c92131dcbbfa5d2de4b054f Mon Sep 17 00:00:00 2001 From: Rafael da Silva Ferreira <2582032-RafaelPlantard@users.noreply.gitlab.com> Date: Thu, 12 Dec 2024 09:46:14 -0300 Subject: [PATCH] refactor: Avoid creating an instance of EKEventStore when it's not needed --- ios/Classes/SwiftDeviceCalendarPlugin.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Classes/SwiftDeviceCalendarPlugin.swift b/ios/Classes/SwiftDeviceCalendarPlugin.swift index 323c8f5a..70762cfd 100644 --- a/ios/Classes/SwiftDeviceCalendarPlugin.swift +++ b/ios/Classes/SwiftDeviceCalendarPlugin.swift @@ -102,7 +102,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() + lazy var eventStore = EKEventStore() let requestPermissionsMethod = "requestPermissions" let hasPermissionsMethod = "hasPermissions" let retrieveCalendarsMethod = "retrieveCalendars"