Go to file
Reda Lemeden 2c3f76e556 Add link to docs 2015-12-02 23:32:02 +01:00
Carthage/Checkouts Update Runes 2015-12-02 22:34:48 +01:00
Demo Add Swift 2.0 support 2015-10-22 19:14:35 +02:00
Gifu.xcodeproj Fix array index out of range bug 2015-10-22 20:49:31 +02:00
Gifu.xcworkspace Add Swift 2.0 support 2015-10-22 19:14:35 +02:00
GifuTests Add Swift 2.0 support 2015-10-22 19:14:35 +02:00
Source Remove unused monadic extensions 2015-12-02 22:38:05 +01:00
bin Use Jazzy config file instead of bin file 2015-12-02 23:25:59 +01:00
.gitignore Ignore docs folder 2015-12-02 22:35:07 +01:00
.gitmodules Add Swift 2.0 support 2015-10-22 19:14:35 +02:00
.jazzy.yaml Use Jazzy config file instead of bin file 2015-12-02 23:25:59 +01:00
.travis.yml Use Travis for CI 2015-12-02 22:35:20 +01:00
Cartfile.private Add Swift 2.0 support 2015-10-22 19:14:35 +02:00
Cartfile.resolved Update Runes 2015-12-02 22:34:48 +01:00
LICENSE Update LICENSE & README 2014-09-10 21:41:13 +02:00
README.md Add link to docs 2015-12-02 23:32:02 +01:00

README.md

Gifu

Adds performant animated GIF support to UIKit. If you're looking for the Japanese prefecture, click here.

How?

Gifu uses a UIImageView subclass and an animator that keeps track of frames and their durations.

It uses CADisplayLink to animate the view and only keeps a limited number of resized frames in-memory, which exponentially minimizes memory usage for large GIF files (+300 frames).

The figure below summarizes how this works in practice. Given an image containing 10 frames, Gifu will load the current frame (red), pre-load the next two frames in this example (orange), and nullify all the other frames to free up memory (gray):

Install

If you use Carthage, add this to your cartfile: github "kaishin/gifu".

If your prefer Git submodules or want to support iOS 7, you want to add the files in source to your Xcode project.

Usage

Start by instantiating an AnimatableImageView either in code or Interface Builder, then call animateWithImage(named:) or animateWithImageData(data:) on it.

let imageView = AnimatableImageView(frame: CGRect(...))
imageView.animateWithImage(named: "mugen.gif")

You can stop the animation anytime using imageView.stopAnimatingGIF(), and resume it using imageView.startAnimatingGIF().

The isAnimatingGIF() method returns the current animation state of the view if it has an animatable image.

See the full documentation.

Demo App

Clone or download the repository and open Gifu.xcworkspace to check out the demo app.

Compatibility

  • iOS 8+

Roadmap

  • Add ability to set the frame-rate

Contributors

Misc

  • The font used in the logo is Azuki
  • The characters used in the icon and example image in the demo are from Samurai Champloo.

License

See LICENSE.