Hi All,
I am having trouble decoding JSON into any of these structures. Am I missing something?
The JSON format I am currently using to test looks like the following ...
{ "center": { "x": 129, "y": 94 }, "radius": 73}I would assume that the automatic Decodable would understand that center is a CGPoint especially when declared as such in ...
struct Circle { var center: CGPoint var radius: CGFloat ... other code here}I have tried automatically as well as manually with the standard let values = try decoder.container(keyedBy: CodingKeys.self) etc.
If I set center to CGPoint.zero in the init(from decoder: Decoder) then all works perfectly so it is obviously the way I am formatting the JSON data.
Any help would be most appreciated.
Thank you in advance,
DSC.david