Hi All,
So Im currently uploading an image to Storage, then I download and then upload the url to cloud firestore and when needed i fetch the url and display the img. But how can i cache the image(s)? So it does not take so long to load every time
This is how i get the Url from cloud Firestore:
BTW im using SwiftUI
func GetImage() {
guard let userID = Auth.auth().currentUser?.uid else { return }
let db = Firestore.firestore()
db.collection("Users").document(userID).collection("PostedImages").document("ImageOneTester").getDocument { (document, error) in
if let document = document, document.exists {
// Extracts the value of the "Url" Field
let imageUrl = document.get("Url") as? String
if imageUrl != nil {
self.urlValue = imageUrl!
}
print("This is URL2: \(imageUrl ?? "URL NOT FOUND")")
} else {
print(error!.localizedDescription)
}
}
}