SwiftGif icon indicating copy to clipboard operation
SwiftGif copied to clipboard

Is there any way to use this with an url instead of a local gif?

Open stijnwesterhof opened this issue 8 years ago • 2 comments

stijnwesterhof avatar Feb 02 '17 14:02 stijnwesterhof

Yes, the UIImage can be created by UIImage.gif(data: Data)

Code would be something like this:

    let url = URL(string: url)
    let data = try? Data(contentsOf: url!)
    let gifImage = UIImage.gif(data: data!)
    imageView.image = gifImage
    

Just take care of two things:

  1. You may want to do it async.
  2. If load from http://, Remember add 'App Transport Security Settings' and set Allow Arbitrary Loads to Yes.

KrisYu avatar Feb 13 '17 19:02 KrisYu

### You can use like this

imgViewGif.setGifFromURL(URL(fileURLWithPath: Bundle.main.path(forResource: "cameraGif", ofType: "gif")!), manager: SwiftyGifManager.defaultManager, loopCount: 1, showLoader: true)

PawanmSpaceo avatar Apr 11 '19 04:04 PawanmSpaceo