Reputation: 53
I need to convert an image I downloaded from Firebase using SDWebImage to a UIImage. How can I do this? Here is my code so far:
Database.database().reference().child("movies").child(movieNumString).observeSingleEvent(of: .value, with: { (snapshot) in
if let dictionary = snapshot.value as? [String: AnyObject] {
let UrlString: String? = ((dictionary["posterPhotoURL"] as? String))
let Url = URL(string: (UrlString)!)
self.moviePosterImageView.sd_setImage(with: Url, placeholderImage: #imageLiteral(resourceName: "PImage"))
}
Upvotes: 0
Views: 1561
Reputation: 100503
You can try this callBack method
self.moviePosterImageView.sd_setImage(with:Url,
placeholderImage: #imageLiteral(resourceName: "PImage"),
options: [],
completed: { (image, error,cacheType, url) in
// here image is the UIImage
self.moviePosterImageView.image = image?.roundedWithBorder(width: 2, color: .red)
})
Upvotes: 1