0

Just what the title says. I am getting this error thrown and not sure if this has to do with the Swift 4 conversion. I have been trying to work around the code but no luck yet so decided to throw this question up on SO. This error is getting thrown on line: "cell.businessPostImage.setImageWith(postRequest,". Thanks.

cell.businessPostImage.image = nil if let postURL = URL(string: downloadURL) { let postRequest = URLRequest(url: postURL) cell.businessPostImage.setImageWith(postRequest, placeholderImage: nil, options: { (imageRequest, imageResponse, image) in cell.businessPostImage.contentMode = UIViewContentMode.scaleToFill cell.businessPostImage.image = image }, completed: { (imageRequest, imageResponse, error) -> Void in // failure downloading image print("Error downloading Firebase post image") print(error) }) } 

This is the error its getting thrown WITH the edit

4
  • Pass in postURL instead of postRequest. Commented Oct 4, 2017 at 20:53
  • Please check the picture I just added of the new error getting thrown because of the edit. Commented Oct 4, 2017 at 21:00
  • You are trying to pass a closure to the options parameter. Commented Oct 4, 2017 at 21:04
  • I understand, should I reformat this block of code? or is there a solution for this? Commented Oct 4, 2017 at 21:07

1 Answer 1

1

You have to use like this :

if let postURL = URL(string: downloadURL) { let postRequest = URLRequest(url: postURL) cell.businessPostImage.setImageWith(postURL, placeholderImage: nil, options: SDWebImageOptions.ProgressiveDownload, completed: { (imageRequest, imageResponse, error) -> Void in // failure downloading image print("Error downloading Firebase post image") print(error) }) } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.