-1

I am using this solution : SO. Where i am loading the gif from the url. My code look like below :

@IBOutlet weak var imageView: UIImageView!

var imageList: [String] = ["http://www.gifbin.com/bin/4802swswsw04.gif", "http://www.gifbin.com/bin/4802swswsw04.gif"]
let imageURL = UIImage.gifImageWithURL(imageList[0])
imageView.image = UIImageView(image: imageURL)

And i am using this This link for gif support as mentioned in that SO. But i am getting error Cannot assign value of type 'UIImageView' to type 'UIImage?. Yes i understood. But how can i fix this and i tried to fix with UIImage but image gif was not showing.

Any solution would be helpful.

I tried even :

imageView.image = UIImage.gifImageWithURL(imageList[currentnImageIndex])

But image was not showing.

turky
  • 5
  • 4

1 Answers1

1

Take a look at the error: Cannot assign value of type 'UIImageView' to type 'UIImage?

You're creating an ImageView and then setting it to the .image, so you probably just need to change:

gifImageView.image = UIImageView(image: imageURL)

to

gifImageView = UIImageView(image: imageURL)

valosip
  • 3,167
  • 1
  • 14
  • 26