You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some JSON where one key path returns an Array<Dictionary<String,Any>>, that is an array of [String:Any] and I want to pass this to a Transformer for manipulation into a different structure.
The issue I have is that Extractor's array and arrayOptional methods expect to return an array of DecodableT. I can see why this works for Transformer<String, URL> and the like thanks to the extensions in StandardLib.swift, but [String:Any] does not conform to Decodable.
The only way I can get this to work is by adding an extension on Dictionary as follows:
I have some JSON where one key path returns an
Array<Dictionary<String,Any>>
, that is an array of[String:Any]
and I want to pass this to aTransformer
for manipulation into a different structure.The issue I have is that
Extractor
'sarray
andarrayOptional
methods expect to return an array ofDecodable
T
. I can see why this works forTransformer<String, URL>
and the like thanks to the extensions inStandardLib.swift
, but[String:Any]
does not conform toDecodable
.The only way I can get this to work is by adding an extension on Dictionary as follows:
Is this correct? Should this be part of
StandardLib.swift
, or am I approaching this in the wrong way?The text was updated successfully, but these errors were encountered: