Can EKEvents be stored using another store(Other then EKEventStore)?

55 Views Asked by At

I am using Core Store in Swift for a MacOS project and I want to schedule Employees (modeled with `CoreStoreSchema`) into shifts (mathematically using WCSP). It's more complicated than that, but that is the basics.

I have here my Employee table, which I want to have multiple calendar events to represent when the employee is available. I also want to assign a int value with each event.

class Employee: CoreStoreObject {
        
        @Field.Stored("name")
        var name: String = ""
        
        
        // Here I want to store an array of Normal/Repeating Events
        @Field.Stored("timeFrames")
        var timeFrames: Array<EkEvent>
    }

For simplicity I only provided a single table with reduced data


What I need to model:

  1. Normal and repeating events in same Array

  2. the repeating attributes (If repeating)

  3. Time start and end

  4. Day

Reasons I don't want to use the EKEventStore:

  1. It would decrease performance(Since it pulls from a different store) and complicate things with Core Store

  2. I already have a store, and I don't want the events to be put on the user's calendar

Reasons I haven't modeled my own Calendar Events using Core Store:

  1. I would just be rewriting the events from EventKit

  2. EventKit has time zone features and other convent features that would be hard to replicate

If you want the full tables: PasteBin (just note it doesn't come with explanations)

1

There are 1 best solutions below

2
benc On

Assuming I understood you correctly, I don't think you need EventKit. The two frameworks provided by Apple are for integration with their Calendar store (which then gets your event data into their first party Calendar.app).

The UI framework allows you to put Apple provided (and somewhat consistent Apple-styled UI) into your custom app. Most of these classes are built assuming you are using the underlying Eventkit.

But if you have your own events and your own UI, Apple provides the timezone, date, date formatting, and calendar-type support outside of EventKit.