I am using IOS SDWebimage library to asynchronous download image and cache it. I would like to know if below method is the right way to do it.
func storeUserPic(uid: String, data: NSData)
{
let filePath = REF_STORAGE.child(“user/test.jpeg")
let metaData = FIRStorageMetadata()
metaData.contentType = "image/jpeg"
filePath.putData(data, metadata: metaData) { (meta, error) in
if let error = error
{
print(error.localizedDescription)
return
}
else
{
self.REF_USERS.child(uid).updateChildValues([“testpic” : meta!.downloadURLs![0].absoluteString])
}
}
}