RSDDateCoder

public protocol RSDDateCoder : Decodable, Encodable

RSDDateCoder is used to handle specifying date encoding/decoding. If the calendar components supported by this formatter only include a subset of all the components then only those components should be displayed in the UI.

  • The formatter to use for encoding and decoding the result.

    Declaration

    Swift

    var resultFormatter: DateFormatter { get }
  • Formatter to use for decoding dates used to set up a date range.

    Declaration

    Swift

    var inputFormatter: DateFormatter { get }
  • Calendar components that are included for this date range.

    Declaration

    Swift

    var calendarComponents: Set<Calendar.Component> { get }
  • The calendar used by this date range when formatting a DateComponents object.

    Declaration

    Swift

    var calendar: Calendar { get }
  • string(from:isResultCoding:) Extension method

    Use the coder to encode a date as a string.

    Declaration

    Swift

    public func string(from date: Date, isResultCoding: Bool = false) -> String?

    Parameters

    date

    The date to encode.

    isResultCoding

    Should this value be encoded using the result formatter?

  • string(from:isResultCoding:) Extension method

    Use the coder to encode date components as a string.

    Declaration

    Swift

    public func string(from dateComponents: DateComponents, isResultCoding: Bool = false) -> String?

    Parameters

    dateComponents

    The date components to encode.

    isResultCoding

    Should this value be encoded using the result formatter?

  • date(from:isResultCoding:) Extension method

    Use the coder to decode a date from a string.

    Declaration

    Swift

    public func date(from string: String, isResultCoding: Bool = false) -> Date?

    Parameters

    string

    The string to decode.

    isResultCoding

    Should this value be encoded using the result formatter?

  • Use the coder to decode date components from a string.

    Declaration

    Swift

    public func dateComponents(from string: String, isResultCoding: Bool = false) -> DateComponents?

    Parameters

    string

    The string to decode.

    isResultCoding

    Should this value be encoded using the result formatter?