Skip to content

JFDynamicLottie is a Swift Lottie Extension which can dynamic replace Lottie resource like image、text and with high performance running Lottie animation.

License

Notifications You must be signed in to change notification settings

DoNext/JFDynamicLottie

 
 

Repository files navigation

JFDynamicLottie

CI Status Version License Platform

JFDynamicLottie is a Lottie Extension which can dynamic replace Lottie resource like image、text and with high performance running Lottie animation.

Usage

First setup your local mainBundle

//setup your main bundle directory to save lottie file also you can setup it in appdelete did finish
        JFLottieAnimationView.setupMainBundleDirectoryPath(path: "Resource/")

And then try it.

var textReplacement: [String:String] = [:]
            textReplacement["我是用户名1"] = "JerryFans"
            textReplacement["我是用户名2"] = "我是被替换的"
            textReplacement["我是用户名5"] = "替换后的名字"
            
            var imgReplacement: [String:UIImage] = [:]
            
            let imgView = UIImageView(image: UIImage(named: "snap"))
            imgView.frame = CGRect(x: 0, y: 0, width: 92, height: 92)
            imgView.layer.cornerRadius = 46
            imgView.layer.masksToBounds = true
            
            if let img = imgView.jf.syncSnapshotImage() {
                imgReplacement["head_0"] = img
            }
            self.lottieView?.imageReplacement = imgReplacement
            self.lottieView?.textReplacement = textReplacement

More usage please see the example code.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

JFDynamicLottie is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'JFDynamicLottie'

Author

JerryFans, [email protected]

License

JFDynamicLottie is available under the MIT license. See the LICENSE file for more info.

About

JFDynamicLottie is a Swift Lottie Extension which can dynamic replace Lottie resource like image、text and with high performance running Lottie animation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 93.1%
  • Ruby 6.9%