Decoder
struct Decoder
-
Decodes an array of Decodable types. Returns an empty array if the key is missing.
- Parameters:
- key: The JSON key to use.
- json: The JSON to decode.
Returns
The array of Decodable type. Empty if the key is missing.Declaration
Swift
public static func decodeArray<T>(key: String, json: JSON) -> [T] where T: DecodableParameters
keyThe JSON key to use.
jsonThe JSON to decode.
Return Value
The array of Decodable type. Empty if the key is missing.
- Parameters:
-
Decodes a dictionary containing an array of types that conform to the ImageResources protocol, and the Decodable protocol.
- Parameters:
- key: key path to the ImageResources in the JSON.
- json: JSON containing an array of encoded ImageResources.
Returns
an dictionary containing an array of ImageResources.Declaration
Swift
public static func decodeImageResources<T: ImageResource>(key: String, json: JSON) -> [String: [T]]? where T: DecodableParameters
keykey path to the ImageResources in the JSON.
jsonJSON containing an array of encoded ImageResources.
Return Value
an dictionary containing an array of ImageResources.
- Parameters:
Decoder Extension Reference