Parsers
-
Default implementation of the
ContactParser
protocol.Parse contact data from json. Each key from JSON represents property name from
CNMutableContact
type.Example:
{ "contactType": "person", "givenName": "Michael" }
DateComponents
is represented as a JSON dictionary:Example:
{ "birthday": { "year": 2016, "month": 5, "day": 19 } }
CNLabeledValue
is represented as a JSON dictionary. The dictionary key is used aslabel
. The value from the dictionary for the key is used asvalue
.Example:
{ "date1": { "year": 2017, "month": 2, "day": 17 } }
Dates, social profiles, phone numbers, email addresses, url addresses, postal addresses, contact relationships and instant message addresses are constructed as a list of dictionaries.
Example:
{ "phoneNumbers": [ { "work": { "stringValue": "0 1234567890" } }, { "mobile": { "stringValue": "0 1234567890" } }, { "nil": { "stringValue": "0 1234567890" } } ] }
Note
"nil"
in the dictionary keys are converted tonil
value.Seealso
Seealso
For full example check
contacts.json
file in the test project.Declaration
Swift
public struct ContactDictionaryParser : ContactParser
-
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.Declaration
Swift
public struct EventDictionaryParser : EventParser
-
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.Declaration
Swift
public struct ReminderDictionaryParser : ReminderParser
-
Defines types and method required to parse and convert any type
See moreT
to a typeU
.Declaration
Swift
public protocol Parser
-
Extension to the
Parser
protocol. Requires the converted object to be an instance of theCNMutableContact
type.Seealso
ContactDictionaryParser
Seealso
ContactsHandler
Declaration
Swift
public protocol ContactParser : Parser where Self.T == Any, Self.U == CNMutableContact
-
Extension to the
Parser
protocol. Requires the converted object to be an instance of theEKEvent
type.Seealso
EventDictionaryParser
Seealso
EventKitHandler
Declaration
Swift
public protocol EventParser : Parser where Self.U == EKEvent
-
Extension to the
Parser
protocol. Requires the converted object to be an instance of theEKReminder
type.Seealso
ReminderDictionaryParser
Seealso
EventKitHandler
Declaration
Swift
public protocol ReminderParser : Parser where Self.U == EKReminder