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 as label. The value from the dictionary for the key is used as value.

    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 to nil value.

    Seealso

    ContactsHandler

    Seealso

    For full example check contacts.json file in the test project.

    See more

    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 check events.json file in the test project.
    See more

    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 check reminders.json file in the test project.
    See more

    Declaration

    Swift

    public struct ReminderDictionaryParser : ReminderParser
  • Defines types and method required to parse and convert any type T to a type U.

    See more

    Declaration

    Swift

    public protocol Parser