HADecodeTransformable
public protocol HADecodeTransformable
Decode a value by massagging into another type
For example, this allows decoding a Date from a String without having to do intermediate casting in calling code.
-
Convert some value to the expected value
Throws
If the value contained errors preventing transformDeclaration
Swift
static func decode(unknown value: Any) throws -> Self?Parameters
valueThe value to decode
Return Value
An instance from value – nil allowed
-
decode(unknown:Extension method) Converts from an unknown value to this raw representable type
Declaration
Swift
static func decode(unknown value: Any) -> Self?Parameters
valueThe value to attempt to convert
Return Value
The value transformed, if it is of the right type and init succeeds
View on GitHub