Reputation:
There is an error for optional while downloading the image from the firebase storage, I am converting the string to URL to download the image
here is the code where the error is occuring , if any more code is required do let me know
let imageUrl = URL(string: post._postuserprofileImagUrl)
ImageService.getImage(withURL: imageUrl) { image in
self.profileImageView.image = image
}
Upvotes: 3
Views: 67
Reputation: 285039
You have to (safely) unwrap the URL instance
if let imageUrl = URL(string: post._postuserprofileImagUrl) {
ImageService.getImage(withURL: imageUrl) { image in
self.profileImageView.image = image
}
}
Or even (if postuserprofileImagUrl
is optional, too)
if let userprofileImagUrl = post._postuserprofileImagUrl,
let imageUrl = URL(string: userprofileImagUrl) {
ImageService.getImage(withURL: imageUrl) { image in
self.profileImageView.image = image
}
}
Upvotes: 2