Coder

public class Coder

Class defining shared resources for the QueryDecoder and QueryEncoder.

Usage Example:

let date = Coder.defaultDateFormatter.date(from: "2017-10-31T16:15:56+0000")!
  • Undocumented

    Declaration

    Swift

    public let dateFormatter: DateFormatter
  • The default DateFormatter used for encoding and decoding query parameters. It uses the “UTC” timezone and “yyyy-MM-dd’T'HH:mm:ssZ” date format.

    Usage Example:

    let date = Coder.defaultDateFormatter.date(from: "2017-10-31T16:15:56+0000")
    

    Declaration

    Swift

    public static let defaultDateFormatter: DateFormatter
  • Initializes a Coder instance with a DateFormatter using the “UTC” timezone and “yyyy-MM-dd’T'HH:mm:ssZ” date format.

    Declaration

    Swift

    public init()
  • Helper method to extract the field name from a CodingKey array.

    Usage Example:

    let fieldName = Coder.getFieldName(from: codingPath)
    

    Declaration

    Swift

    public static func getFieldName(from codingPath: [CodingKey]) -> String