EventDictionaryParser
public struct EventDictionaryParser : EventParser
Default implementation of the EventParser protocol.
Parse event data from json. Each key from JSON represents property name from the the EKEvent type.
Example:
{
"title": "Minimal Event Title",
"startDate": "2017-01-22 13:45:00",
"endDate": "2017-01-22 14:30:00"
}
Seealso
EventKitHandler
Seealso
For full example checkevents.json file in the test project.
-
Events store used to create and save events.
Declaration
Swift
public var eventStore: EKEventStore! -
Calendar in which events will be saved.
Declaration
Swift
public var calendar: EKCalendar?
-
Initializes parser with event store and calendar.
Declaration
Swift
public init(with eventStore: EKEventStore, calendar: EKCalendar? = nil)Parameters
eventStoreEvents store used to create and save events.
calendarCalendar in which events will be saved. If
nil, thedefaultCalendarForNewEventswill be used. -
Initializes parser without event store and calendar.
Note
EKEventStore is implicitly unwrapped, so it needs to be set anyway before parsing attempt.Declaration
Swift
public init()
-
Parses JSON dictionary and returns parsed
EKEventobject.Declaration
Swift
public func parse(_ json: [String : Any]) throws -> EKEventParameters
dataJSON dictionary to parse.
Return Value
Parsed event.
EventDictionaryParser Structure Reference