When you implement Codable
on an object, the compiler can automatically generate a constructor for you. However it only does this if you haven't written an initializer that accepts a decoder yourself.
That said, we have an object with ~50 let
properties which are set from the decoder, but we also have five computed properties which are based on those let
properties.
Technically if we could compute them in the initializer, after the decoder has set the other 50, we could simply store the results in let
vars of their own, eliminating the need for computed properties altogether.
The problem is, as mentioned, if you implement your own initializer, the compiler doesn't auto-generate one for you so you're left not just initializing your 'computed' values, but all values.
So is there a way you can insert yourself as part of the initialization/decoding process without having to fully rewrite the initializer yourself?