HADataDecodable
public protocol HADataDecodable : HADecodeTransformable
A type which can be decoded using our data type
Note
This differs fromDecodable
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 decodeDeclaration
Swift
init(data: HAData) throws
Parameters
data
The data to decode
-
decode(unknown:
Extension method) Create a
HADataDecodable
instance via.decode(…)
indirectionThrows
When unable to decodeDeclaration
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