HADataDecodable

public protocol HADataDecodable : HADecodeTransformable

A type which can be decoded using our data type

Note

This differs from Decodable intentionally; Decodable does not support Any types or JSON well when the results are extremely dynamic. This limitation requires that we do it ourselves.
  • Create an instance from data One day, if Decodable can handle ‘Any’ types well, this can be init(decoder:).

    Throws

    When unable to decode

    Declaration

    Swift

    init(data: HAData) throws

    Parameters

    data

    The data to decode

  • decode(unknown:) Extension method

    Create a HADataDecodable instance via .decode(…) indirection

    Throws

    When unable to decode

    Declaration

    Swift

    static func decode(unknown value: Any) throws -> Self?

    Parameters

    value

    The value to convert to HAData for the init

    Return Value

    The decodable initialized with the given value