SwiftyGif alternatives and similar libraries
Based on the "Images" category.
Alternatively, view SwiftyGif alternatives based on common mentions on social networks and blogs.
-
SwiftGen-Assets
The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs! -
GPUImage 2
GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing. -
SkyFloatingLabelTextField
A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift. -
GPUImage 3
GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal. -
Brightroom
DISCONTINUED. 📷 A composable image editor using Core Image and Metal. [Moved to: https://github.com/FluidGroup/Brightroom] -
CTPanoramaView
A library that displays spherical or cylindrical panoramas with touch or motion based controls. -
FMPhotoPicker
A modern, simple and zero-dependency photo picker with an elegant and customizable image editor -
AXPhotoViewer
An iOS/tvOS photo gallery viewer, useful for viewing a large (or small!) number of photos. -
PassportScanner
Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer. -
Harbeth
🎨 GPU accelerated image / video and camera filter library based on Metal. Support macOS & iOS. 图像、视频、相机滤镜框架 -
JLStickerTextView
add text(multiple line support) to imageView, edit, rotate or resize them as you want, then render the text on image -
XAnimatedImage
XAnimatedImage is a performant animated GIF engine for iOS written in Swift based on FLAnimatedImage -
UIImageView-BetterFace-Swift
DISCONTINUED. autoresize images and if any face discovered refine the position of the image. -
SwiftDraw
Swift library and command line tool to convert SVGs into SFSymbol, PNG, PDF and Swift source code. -
KFSwiftImageLoader
An extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memory and disk caching for iOS and Watch. -
MCScratchImageView
A custom ImageView that is used to cover the surface of other view like a scratch card, user can swipe the mulch to see the view below. -
FacebookImagePicker
DISCONTINUED. FacebookImagePicker is Facebook album photo picker written in Swift. -
DTPhotoViewerController
A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SwiftyGif or a related project?
README
SwiftyGif
High performance & easy to use Gif engine
Features
- [x] UIImage and UIImageView extension based
- [x] Remote GIFs with customizable loader
- [x] Great CPU/Memory performances
- [x] Control playback
- [x] Allow control of display quality by using 'levelOfIntegrity'
- [x] Allow control CPU/memory tradeoff via 'memoryLimit'
Installation
With CocoaPods
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
pod 'SwiftyGif'
With Carthage
Follow the usual Carthage instructions on how to add a framework to an application. When adding SwiftyGif among the frameworks listed in Cartfile
, apply its syntax for GitHub repositories:
github "kirualex/SwiftyGif"
With Swift Package Manager
https://github.com/kirualex/SwiftyGif.git
How to Use
Project files
As of now, Xcode xcassets
folders do not recognize .gif
as images. This means you need to put your .gif
oustide of the assets. I recommend creating a group gif
for instance.
Quick Start
SwiftyGif uses familiar UIImage
and UIImageView
to display gifs.
Programmaticaly
import SwiftyGif
do {
let gif = try UIImage(gifName: "MyImage.gif")
let imageview = UIImageView(gifImage: gif, loopCount: 3) // Will loop 3 times
imageview.frame = view.bounds
view.addSubview(imageview)
} catch {
print(error)
}
Directly from nib/storyboard
@IBOutlet var myImageView : UIImageView!
...
let gif = try UIImage(gifName: "MyImage.gif")
self.myImageView.setGifImage(gif, loopCount: -1) // Will loop forever
Remote GIFs
// You can also set it with an URL pointing to your gif
let url = URL(string: "...")
let loader = UIActivityIndicatorView(style: .white)
cell.gifImageView.setGifFromURL(url, customLoader: loader)
Performances
A SwiftyGifManager
can hold one or several UIImageView using the same memory pool. This allows you to tune the memory limits to you convenience. If no manager is declared, SwiftyGif will just use the SwiftyGifManager.defaultManager
.
Level of integrity
Setting a lower level of integrity will allow for frame skipping, lowering both CPU and memory usage. This can be a good option if you need to preview a lot of gifs at the same time.
do {
let gif = try UIImage(gifName: "MyImage.gif", levelOfIntegrity:0.5)
} catch {
print(error)
}
Controls
SwiftyGif offer various controls on the current UIImageView
playing your gif file.
self.myImageView.startAnimatingGif()
self.myImageView.stopAnimatingGif()
self.myImageView.showFrameAtIndexDelta(delta: Int)
self.myImageView.showFrameAtIndex(index: Int)
To allow easy use of those controls, some utility methods are provided :
self.myImageView.isAnimatingGif() // Returns wether the gif is currently playing
self.myImageView.gifImage!.framesCount() // Returns number of frames for this gif
Delegate
You can declare a SwiftyGifDelegate to receive updates on the gif lifecycle.
For instance, if you want your controller MyController
to act as the delegate:
override func viewDidLoad() {
super.viewDidLoad()
self.imageView.delegate = self
}
Then simply add an extension:
extension MyController : SwiftyGifDelegate {
func gifURLDidFinish(sender: UIImageView) {
print("gifURLDidFinish")
}
func gifURLDidFail(sender: UIImageView) {
print("gifURLDidFail")
}
func gifDidStart(sender: UIImageView) {
print("gifDidStart")
}
func gifDidLoop(sender: UIImageView) {
print("gifDidLoop")
}
func gifDidStop(sender: UIImageView) {
print("gifDidStop")
}
}
Benchmark
Display 1 Image
CPU Usage(average) | Memory Usage(average) | |
---|---|---|
FLAnimatedImage | 35% | 9,5Mb |
SwiftyGif | 2% | 18,4Mb |
SwiftyGif(memoryLimit:10) | 34% | 9,5Mb |
Display 6 Images
CPU Usage(average) | Memory Usage(average) | |
---|---|---|
FLAnimatedImage | 65% | 25,1Mb |
SwiftyGif | 22% | 105Mb |
SwiftyGif(memoryLimit:20) | 45% | 26Mb |
Measured on an iPhone 6S, iOS 9.3.1 and Xcode 7.3.
*Note that all licence references and agreements mentioned in the SwiftyGif README section above
are relevant to that project's source code only.