A small UIImage
extension with gif support.
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)
Easy, it does the following:
- Find out the duration of every frame
- Find the greatest common divisor
- Add frames accordingly to the greatest common divisor to an array
- Create an animated UIImage with the frames
This project is heavily inspired by uiimage-from-animated-gif. Kudos to @mayoff. 👍
This repository is licensed under the MIT license, more under LICENSE.