zjfjack / JZCalendarWeekView

Calendar Week & Day View in iOS Swift
MIT License
448 stars 120 forks source link

How to convert [EKEvent] to [JZBaseEvent] #92

Closed malignois closed 5 years ago

malignois commented 5 years ago

Hello and thank you for this amazing framework.

I am trying to convert an event array containing EKevent I am using everywhere in my app to an array of JZBaseEvent required to make the framework work.

To do already did this ?

Thank you for your help.

malignois commented 5 years ago

I found the solution.

let eventsArrayForJZ = eventStore.events(matching: aPredicate)

            for event in eventsArrayForJZ {
                let JZevent = BaseEvent(id: event.eventIdentifier, title: event.title, startDate: event.startDate, endDate: event.endDate, color: UIColor(cgColor: event.calendar!.cgColor), isAllDay: event.isAllDay)
                JZeventsArray.append(JZevent)
            }