Latest 1.6.1
Homepage https://github.com/bahlo/SwiftGif
License MIT
Platforms ios 8.0, tvos 9.0
Authors

SwiftGif Swift 3.0 Carthage compatible CocoaPods License MIT Build Status

A small UIImage extension with gif support.

Demo gif

Usage

// An animated UIImage
let jeremyGif = UIImage.gif(name: "jeremy")

// A UIImageView with async loading
let imageView = UIImageView()
imageView.loadGif(name: "jeremy")

Installation

CocoaPods

Install CocoaPods with the following command:

gem install cocoapods

Integrate SwiftGif into your Xcode project by creating a Podfile:

platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'SwiftGifOrigin', '~> 1.6.1'
end

Run pod install to build your dependencies.

Carthage

Install Carthage with
Homebrew using the following command:

brew update
brew install carthage

Add the following line to your Cartfile to add SwiftGif:

github "bahlo/SwiftGif" ~> 1.6.1

Run carthage update to build the framework and drag the built
SwiftGif.framework into your Xcode project.

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. :thumbsup:

License

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

Latest podspec

{
    "name": "SwiftGifOrigin",
    "version": "1.6.1",
    "license": {
        "type": "MIT"
    },
    "homepage": "https://github.com/bahlo/SwiftGif",
    "authors": {
        "Arne Bahlo": "[email protected]e"
    },
    "summary": "A small UIImage extension with gif support",
    "source": {
        "git": "https://github.com/bahlo/SwiftGif.git",
        "tag": "v1.6.1"
    },
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "source_files": "SwiftGifCommon/*.swift",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This