SwiftySVGAPlayer 1.4.5

SwiftySVGAPlayer 1.4.5

Maintained by janlionly.



SwiftySVGAPlayer

Version License Platform Swift

Description

SwiftySVGAPlayer is a high level APIs based on SVGAPlayer, which support play svga according url or local svga data, default push svga in FIFO queue, and then pop to play, and you can set isInstant true for cancel the queue.

Installation

CocoaPods

pod 'SwiftySVGAPlayer'

Usage

just one line code to play svga:

// for example in a controller:
SwiftySVGAPlayer().pushToPlay(svga: "https://xxx/filename.svga", on: self.view)

// Warning: Playing a svga maybe slow for the first time, you could batch cache svgas in some place like after app launch or log in before play them
SwiftySVGAPlayer().cache(svga: "https://xxx/filename.svga")


// Optional: ----------------------------------------------------
// detail properties and methods
/// Whether user interaction enabled when play svga
public var isUserInteractionEnabled: Bool

/// Whether add shadow mask when play svga
public var isMask: Bool

/// Whether play a single svga forever
public var isInfinite: Bool

/// Add svga urlstring or svgadata's base64string to FIFO queue and pop to play
open func play(svga urlString: String, on view: UIView, isInstant: Bool = false, scale: CGFloat = 1)

/// prepare to cache for svga url
public func cache(svga urlString: String, failure: ((Error) -> Void)? = nil)

/// reset player to inital state
open func clear()

/// other methods for example pause/stop/play and so on, please see the demo in rep

Requirements

  • iOS 9.0+
  • Swift 4.2 to 5.1

Author

Visit my github: janlionly
Contact with me by email: [email protected]

Contribute

I would love you to contribute to SwiftySVGAPlayer

License

SwiftySVGAPlayer is available under the Apache 2.0 license. See the LICENSE file for more info.