default values not working if field doesn't exist.
WingYn opened this issue · 2 comments
WingYn commented
default value ignored so that the value becomes nil instead of what is set.
struct A: Codable {
var A: Double? = 1.0
}´´´
alickbass commented
It is not ignored. If value is missing in Firebase, it is will be nil in the stuct, as all the properties of the struct are initialized from the Firebase. If you want to always have some value, first of all, the value should not be Optional, and secondly you have to override the Codable constructor and specify the default values there
alickbass commented
Closing issue due to lack of activity