From 2915c8e7a390440ad46201b97d5e68b8c6c6fffd 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 0ea540d3..5dd2ba71 100644 --- a/ios/Classes/SwiftDeviceCalendarPlugin.swift +++ b/ios/Classes/SwiftDeviceCalendarPlugin.swift @@ -90,7 +90,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"