I have the following object:
struct CustomModel: Codable {
var id: String?
var creationTime: Timestamp? <-----
var providerData: [ProviderData]?
var uid: String?
enum CodingKeys: String, CodingKey {
case id
case creationTime
case providerData
case uid
}
}
Decoding it:
JSONDecoder().decode(CustomModel.self, from: jsonData)
I'm getting the following error for trying to Decode the Firebase Timestamp:
could not parse json keyNotFound(TimestampKeys(stringValue: "seconds", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "creationTime", intValue: nil)], debugDescription: "No value associated with key TimestampKeys(stringValue: "seconds", intValue: nil) ("seconds").", underlyingError: nil))
I'm using Firebase Functions to interact with Firebase, and with that I need to decode this object, the problem is that I have no idea how to handle the creationTime firebase timestamp. I don't wanna use CodableFirestore library since its outdated. Any suggestions?