satoshin2071 / SwiftGif

:sparkles: A small UIImage extension with gif support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftGif Swift 2.0 Carthage compatible CocoaPods License MIT Build Status

A small UIImage extension with gif support.

Demo gif

Usage

Import the Gif.swift in your project and do the following:

// Returns an animated UIImage
let jeremyGif = UIImage.gifWithName("jeremy")

// Use the UIImage in your UIImageView
let imageView = UIImageView(image: jeremyGif)

How does it work?

Easy, it does the following:

  1. Find out the duration of every frame
  2. Find the greatest common divisor
  3. Add frames accordingly to the greatest common divisor to an array
  4. Create an animated UIImage with the frames

Inspiration

This project is heavily inspired by uiimage-from-animated-gif. Kudos to @mayoff. 👍

License

This repository is licensed under the MIT license, more under LICENSE.

About

:sparkles: A small UIImage extension with gif support

License:MIT License


Languages

Language:Swift 95.6%Language:Ruby 4.4%