Fix decoding migration

sync_v2
Laurent 7 months ago
parent eab91fcd8c
commit 1d416ebdd6
  1. 10
      LeStorage/Codables/Settings.swift

@ -18,4 +18,14 @@ class Settings: MicroStorable {
var deviceId: String? = nil
var lastSynchronization: String = "2000-01-01T00:00:00.000000Z"
required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
userId = try container.decodeIfPresent(String.self, forKey: .userId)
username = try container.decodeIfPresent(String.self, forKey: .username)
deviceId = try container.decodeIfPresent(String.self, forKey: .deviceId)
lastSynchronization = try container.decodeIfPresent(String.self, forKey: .lastSynchronization) ?? "2000-01-01T00:00:00.000000Z"
}
}

Loading…
Cancel
Save