GIFAnimatable
public protocol GIFAnimatable: class
The protocol that view classes need to conform to to enable animated GIF support.
-
Responsible for managing the animation frames.
Declaration
Swift
var animator: Animator?
-
Notifies the instance that it needs display.
Declaration
Swift
var layer: CALayer
-
View frame used for resizing the frames.
Declaration
Swift
var frame: CGRect
-
Content mode used for resizing the frames.
Declaration
Swift
var contentMode: UIViewContentMode
-
intrinsicContentSize
Extension methodReturns the intrinsic content size based on the size of the image.
Declaration
Swift
public var intrinsicContentSize: CGSize
-
activeFrame
Extension methodReturns the active frame if available.
Declaration
Swift
public var activeFrame: UIImage?
-
frameCount
Extension methodTotal frame count of the GIF.
Declaration
Swift
public var frameCount: Int
-
isAnimatingGIF
Extension methodIntrospect whether the instance is animating.
Declaration
Swift
public var isAnimatingGIF: Bool
-
animate(withGIFNamed:)
Extension methodPrepare for animation and start animating immediately.
Declaration
Swift
public func animate(withGIFNamed imageName: String)
Parameters
imageName
The file name of the GIF in the main bundle.
-
animate(withGIFData:)
Extension methodPrepare for animation and start animating immediately.
Declaration
Swift
public func animate(withGIFData imageData: Data)
Parameters
imageData
GIF image data.
-
prepareForAnimation(withGIFNamed:)
Extension methodPrepares the animator instance for animation.
Declaration
Swift
public func prepareForAnimation(withGIFNamed imageName: String)
Parameters
imageName
The file name of the GIF in the main bundle.
-
prepareForAnimation(withGIFData:)
Extension methodPrepare for animation and start animating immediately.
Declaration
Swift
public func prepareForAnimation(withGIFData imageData: Data)
Parameters
imageData
GIF image data.
-
prepareForReuse()
Extension methodStop animating and free up GIF data from memory.
Declaration
Swift
public func prepareForReuse()
-
startAnimatingGIF()
Extension methodStart animating GIF.
Declaration
Swift
public func startAnimatingGIF()
-
stopAnimatingGIF()
Extension methodStop animating GIF.
Declaration
Swift
public func stopAnimatingGIF()
-
setShouldResizeFrames(_:)
Extension methodWhether the frame images should be resized or not. The default is
false
, which means that the frame images retain their original size.Declaration
Swift
public func setShouldResizeFrames(_ resize: Bool)
Parameters
resize
Boolean value indicating whether individual frames should be resized.
-
setFrameBufferCount(_:)
Extension methodSets the number of frames that should be buffered. Default is 50. A high number will result in more memory usage and less CPU load, and vice versa.
Declaration
Swift
public func setFrameBufferCount(_ frames: Int)
Parameters
frames
The number of frames to buffer.
-
updateImageIfNeeded()
Extension methodUpdates the image with a new frame if necessary.
Declaration
Swift
public func updateImageIfNeeded()