Installing the Lottie Library Using CocoaPods
Once you create the project, stop Xcode and then open Terminal. We are going to create a Podfile for the set up of Lottie library. I count on you have some journey with CocoaPods, and have it mounted on your Mac.
In terminal, run the following command to create a Podfile:
Then open and edit the Podfile like this:
We simply add a line pod 'lottie-ios'
to indicate the pod we need for this project. Now go back to Terminal and run the command below:
CocoaPods will then down load the Lottie library and bundle it in your Xcode project. When the technique completes, you will discover a new venture file named LottieDemo.xcworkspace. Open this file the usage of Xcode and begin coding.
Adding the Animation JSON Files
It would be extremely good if you have your very own animation file for checking out Lottie. But if you don’t have one, down load this free animation in the shape of JSON file from lottiefiles.com. We will use that for the rapid demo.
Now drag the JSON file (servishero_loading.json) into the task navigator of your Xcode project. Put it underneath the LottieDemo group.
Creating LOTAnimationView
It now comes to the exciting part. In much less than 10 traces of code, you will be in a position to put into effect the pattern animation.
Open ViewController.swift and add a line of code to import the Lottie library:
Next, update the viewDidLoad()
method like this:
0 Comments