Lottie animations
How to make Lottie animations work on your paywalls
Last updated
Was this helpful?
How to make Lottie animations work on your paywalls
Last updated
Was this helpful?
Lightweight, vectorial with a huge community, has become the leading technology to create animations in applications.
From now on you can add Lottie animations in Purchasely paywalls but it requires a little setup from your mobile developers.
At Purchasely we value having a lightweight SDK (< 2Mb) with no external dependencies.
Thus, when we wanted to offer Lottie animations we didn't want to add it as a direct dependency of our SDK. This would have multiplied by 5 the weight of our SDK and users who didn't use it would have had to have to pay that extra cost.
This is how we ended up doing a weak dependency.
At runtime, our SDKs will be looking at Lottie's presence and will add the view to its paywall. It will be able to configure the aspect (fill / fit) and wether or not the animation repeats.
As Purchasely SDK will be calling methods it needed a stable interface to avoid calling a method that wouldn't exist (and crash). This is why we created an interface to Lottie that will remain stable and will embed calls to Lottie framework so that we don't need to rely on them.
You will need to add this interface to your code and Lottie SDK in your dependencies.
First you need to (if not already in your app)
Then add the following Swift class to your code
🎉 You are all set!
Lottie integration requires our SDK version 3.6.0 minimum
Then implements PLYLottieInterface
, you can copy the following sample AnimationView
class
Finally add it to Purchasely with
First you need to (if not already in your app)