ReminderDictionaryParser
public struct ReminderDictionaryParser : ReminderParser
Default implementation of the ReminderParser
protocol.
Parse reminder data from json. Each key from JSON represents property name from the EKReminder
type.
Example:
{
"title": "Minimal Reminder Title",
"priority": 3
}
DateComponents
is represented as a JSON dictionary:
Example:
{
"startDateComponents": {
"timeZone": {
"identifier": "America/Los_Angeles",
},
"year": 2017,
"month": 10,
"day": 24,
"hour": 12,
"minute": 25,
"second": 0
}
}
Seealso
EventKitHandler
Seealso
For full example checkreminders.json
file in the test project.
-
Events store used to create and save reminders.
Declaration
Swift
public var eventStore: EKEventStore!
-
Calendar in which reminders 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
eventStore
Events store used to create and save events.
calendar
Calendar in which events will be saved. If
nil
, thedefaultCalendarForNewEvents
will 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()
-
Parse JSON dictionary and return parsed
EKReminder
object.Declaration
Swift
public func parse(_ json: [String : Any]) throws -> EKReminder
Parameters
data
JSON dictionary to parse.
Return Value
Parsed reminder.