I would like to parse json file in init of my model. I want it to take URL and initialize all stored properties. Like:
init(from url: URL) { ... }
,
so the question is how do I do it? I tried to do it this way:
let info = try JSONDecoder().decode(Model.self, from: data)
,
but it just creates a new object and seems like a bad decision.
Thanks.