2

I want to create a EKEventStore object, and use it in different classes, Can I use different instances in each class ? or I have to create one EKEventStore instance using singleton pattern?

Apple documentation recommend creation of one instance, but they are not specifying if this one instance is per class, or per the whole application, Please advice and here I am quoting from apple documentation: "An EKEventStore object requires a relatively large amount of time to initialize and release. Consequently, you should not initialize and release a separate event store for each event-related task. Instead, initialize a single event store when your app loads, and use it repeatedly to ensure that your connection is long-lived."

Regards

Ayman Melhem
  • 493
  • 3
  • 13

1 Answers1

3

Personally I use a singleton and I think the wording "initialize a single event store when your app loads" supports this.

craigmarch
  • 534
  • 3
  • 9
  • Apple suggests to do so in the App delegate. Fine. How then, do I call that event store from a ViewController without instantiating it again? (please excuse my noobness) – Josh Mar 06 '18 at 14:54