Parser

public protocol Parser

Defines types and method required to parse and convert any type T to a type U.

  • T

    A source type that the parser works with.

    A parser takes an instance of type T and returns an instance of type U.

    Declaration

    Swift

    associatedtype T
  • U

    A result type that the parser works with.

    A parser takes an instance of type T and returns an instance of type U.

    Declaration

    Swift

    associatedtype U
  • Methods which converts a type T to a type U.

    Throws

    Throws an error if object cannot be converted.

    Declaration

    Swift

    func parse(_ data: T) throws -> U

    Parameters

    data

    Object to convert, eg. Dictionary.

    Return Value

    Converted object, eg. CNMutableContact.