I have a simple User class which has the following fields:
{
"localIdentifier": "xyc9870",
"isOnline": false,
"username": "ZS"
}
I want to use Swift's Decodable to easily turn the QueryDocumentSnapshot into a type safe Swift struct. I also want to make sure that I get the documentID from theĀ QueryDocumentSnapshot for updating the object later.
This is what I'm currently using to decode but obviously it misses the documentId
struct User: Decodable {
let localIdentifier: String
let username: String
let isOnline: Bool
}
Would love a hand here. Thanks!