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 method

    Returns the intrinsic content size based on the size of the image.

    Declaration

    Swift

    public var intrinsicContentSize: CGSize
  • activeFrame Extension method

    Returns the active frame if available.

    Declaration

    Swift

    public var activeFrame: UIImage?
  • frameCount Extension method

    Total frame count of the GIF.

    Declaration

    Swift

    public var frameCount: Int
  • isAnimatingGIF Extension method

    Introspect whether the instance is animating.

    Declaration

    Swift

    public var isAnimatingGIF: Bool
  • animate(withGIFNamed:) Extension method

    Prepare 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 method

    Prepare for animation and start animating immediately.

    Declaration

    Swift

    public func animate(withGIFData imageData: Data)

    Parameters

    imageData

    GIF image data.

  • Prepares 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.

  • Prepare for animation and start animating immediately.

    Declaration

    Swift

    public func prepareForAnimation(withGIFData imageData: Data)

    Parameters

    imageData

    GIF image data.

  • prepareForReuse() Extension method

    Stop animating and free up GIF data from memory.

    Declaration

    Swift

    public func prepareForReuse()
  • startAnimatingGIF() Extension method

    Start animating GIF.

    Declaration

    Swift

    public func startAnimatingGIF()
  • stopAnimatingGIF() Extension method

    Stop animating GIF.

    Declaration

    Swift

    public func stopAnimatingGIF()
  • setShouldResizeFrames(_:) Extension method

    Whether 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 method

    Sets 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 method

    Updates the image with a new frame if necessary.

    Declaration

    Swift

    public func updateImageIfNeeded()