Я следил за документацией Firebase и столкнулся с этой ошибкой, и я не уверен, как ее устранить.
Вот мой код и ошибка, которую я получаю в сети "let dataDescription = ... "
Невозможно преобразовать тип результата вызова '[]' в ожидаемый тип '?'
let key = UserDefaults.standard.value(forKey: "uid") as! String
let docRef = firebaseDB.collection("user").document(key)
docRef.getDocument { (document, error) in
if let document = document, document.exists {
let dataDescription = document.data().map(String.init(describing:)) ?? "nil"
print("Document data: \(dataDescription)")
} else {
print("Document does not exist")
}
}