PPSwiftGifs
PPSwiftGifs copied to clipboard
PPSwiftGifs provides a convenient way to show animated GIF images as a part of iOS GUI.
PPSwiftGifs
PPSwiftGifs provides a convenient way to show animated GIF images as a part of iOS GUI.
Installation
Carthage
> Cartfilenano Cartfile- put
github "peterprokop/PPSwiftGifs"into Cartfile - Save it:
ctrl-x,y,enter - Run
carthage update - Copy
PPSwiftGifs.frameworkfromCarthage/Build/iOSto your project - Make sure that
PPSwiftGifsis added inEmbedded Binariessection of your target (or else you will getdyld library not loaded referenced from ... reason image not founderror) - Add
import PPSwiftGifson top of your view controller's code
Manual
- Just clone this repo and add
PPSwiftGifs.swiftto your project. - Add ImageIO.framework to your project.
- Add
#import <ImageIO/ImageIO.h>to bridging header.
Requirements
Swift 5. For older Swift versions please check previous releases.
Usage
imageView.image = PPSwiftGifs.animatedImageWithGIF(named: "gif_name")
(File named "gif_name.gif" should be present in your project and copied as a bundle resource. Currently you can't add GIFs to asset catalogs.)
Alternatively, you can construct animated image from data:
imageView.image = PPSwiftGifs.animatedImageWithGIF(data: data)
Author(s)
PPSwiftGifs is written by Peter Prokop but borrows heavily from uiimage-from-animated-gif project by Rob Mayoff.
Contribution
You are welcome to fork and submit pull requests