SwiftGif
SwiftGif copied to clipboard
Is there any way to use this with an url instead of a local gif?
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:
- You may want to do it async.
- If load from
http://
, Remember add 'App Transport Security Settings' and setAllow Arbitrary Loads
to Yes.
### You can use like this
imgViewGif.setGifFromURL(URL(fileURLWithPath: Bundle.main.path(forResource: "cameraGif", ofType: "gif")!), manager: SwiftyGifManager.defaultManager, loopCount: 1, showLoader: true)