gpt4 book ai didi

Can EKEvents be stored using another store(Other then EKEventStore)?(是否可以使用其他存储(不是EKEventStore)存储EKEvent?)

转载 作者:bug小助手 更新时间:2023-10-26 21:00:34 25 4
gpt4 key购买 nike



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.

我正在使用SWIFT中的Core Store进行MacOS项目,我想安排员工(使用`CoreStoreSchema`建模)轮班(数学上使用WCSP)。事情比这复杂得多,但这是最基本的。


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.

这里有我的Employee表,我希望在员工有空时使用多个日历事件来表示。我还想为每个事件分配一个int值。


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:

我不想使用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:

我没有使用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)

如果你想要完整的表格:Pastebin(只需注意它没有附带解释)


更多回答
优秀答案推荐

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).

假设我理解正确,我认为您不需要EventKit。苹果提供的两个框架是为了与他们的日历商店集成(然后它会将你的活动数据放入他们的第一个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.

UI框架允许您将Apple提供的(以及某种程度上一致的Apple风格的UI)放入您的定制应用程序中。这些类中的大多数都是假设您使用底层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.

但是如果你有自己的事件和自己的UI,Apple会在EventKit之外提供时区、日期、日期格式和日历类型支持。


更多回答

FYI - EKEventEditViewController only works with EKEventStore. So this answer seems wrong for that reason.

仅供参考-EKEventEditViewController仅适用于EKEventStore。因此,出于这个原因,这个答案似乎是错误的。

What you are saying is true, but I think I'm giving the right answer for the question. I edited the answer, so it's more explicit for what you mentioned.

你说的是真的,但我想我对这个问题给出了正确的答案。我对答案进行了编辑,因此对于您提到的内容更加明确。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com