1# Lottie for iOS, macOS (and [Android](https://github.com/airbnb/lottie-android) and [React Native](https://github.com/airbnb/lottie-react-native)) 2[![Version](https://img.shields.io/cocoapods/v/lottie-ios.svg?style=flat)](https://cocoapods.org/pods/lottie-ios)[![License](https://img.shields.io/cocoapods/l/lottie-ios.svg?style=flat)](https://cocoapods.org/pods/lottie-ios)[![Platform](https://img.shields.io/cocoapods/p/lottie-ios.svg?style=flat)](https://cocoapods.org/pods/lottie-ios) 3 4# View documentation, FAQ, help, examples, and more at [airbnb.io/lottie](http://airbnb.io/lottie/) 5 6Lottie is a mobile library for Android and iOS that natively renders vector based animations and art in realtime with minimal code. 7 8Lottie loads and renders animations and vectors exported in the bodymovin JSON format. Bodymovin JSON can be created and exported from After Effects with [bodymovin](https://github.com/bodymovin/bodymovin), Sketch with [Lottie Sketch Export](https://github.com/buba447/Lottie-Sketch-Export), and from [Haiku](https://www.haiku.ai). 9 10For the first time, designers can create **and ship** beautiful animations without an engineer painstakingly recreating it by hand. 11Since the animation is backed by JSON they are extremely small in size but can be large in complexity! 12Animations can be played, resized, looped, sped up, slowed down, reversed, and even interactively scrubbed. 13Lottie can play or loop just a portion of the animation as well, the possibilities are endless! 14Animations can even be ***changed at runtime*** in various ways! Change the color, position or any keyframable value! 15Lottie also supports native UIViewController Transitions out of the box! 16 17Here is just a small sampling of the power of Lottie 18 19![Example1](_Gifs/Examples1.gif) 20![Example2](_Gifs/Examples2.gif) 21 22<img src="_Gifs/Community 2_3.gif" /> 23 24![Example3](_Gifs/Examples3.gif) 25 26![Abcs](_Gifs/Examples4.gif) 27 28## Installing Lottie 29Lottie supports [CocoaPods](https://cocoapods.org/) and [Carthage](https://github.com/Carthage/Carthage) (Both dynamic and static). Lottie is written in ***Swift 4.2***. 30### Github Repo 31 32You can pull the [Lottie Github Repo](https://github.com/airbnb/lottie-ios/) and include the Lottie.xcodeproj to build a dynamic or static library. 33 34### CocoaPods 35Add the pod to your Podfile: 36```ruby 37pod 'lottie-ios' 38``` 39 40And then run: 41```ruby 42pod install 43``` 44After installing the cocoapod into your project import Lottie with 45```swift 46import Lottie 47``` 48### Carthage 49Add Lottie to your Cartfile: 50``` 51github "airbnb/lottie-ios" "master" 52``` 53 54And then run: 55``` 56carthage update 57``` 58In your application targets “General” tab under the “Linked Frameworks and Libraries” section, drag and drop lottie-ios.framework from the Carthage/Build/iOS directory that `carthage update` produced. 59 60### Swift Package Manager 61``` swift 62// swift-tools-version:5.1 63 64import PackageDescription 65 66let package = Package( 67 name: "YourTestProject", 68 platforms: [ 69 .iOS(.v12), 70 ], 71 dependencies: [ 72 .package(url: "https://github.com/airbnb/lottie-ios.git", from: "3.1.2") 73 ], 74 targets: [ 75 .target(name: "YourTestProject", dependencies: ["Lottie"]) 76 ] 77) 78``` 79And then import wherever needed: ```import Lottie``` 80 81#### Adding it to an existent iOS Project via Swift Package Manager 82 831. Using Xcode 11 go to File > Swift Packages > Add Package Dependency 842. Paste the project URL: https://github.com/airbnb/lottie-ios 853. Click on next and select the project target 86 **NOTE: For MacOS you must set the `Branch` field to `lottie/macos-spm` 87 ![Example](_Gifs/spm-branch.png) 88 89If you have doubts, please, check the following links: 90 91[How to use](https://developer.apple.com/videos/play/wwdc2019/408/) 92 93[Creating Swift Packages](https://developer.apple.com/videos/play/wwdc2019/410/) 94 95After successfully retrieved the package and added it to your project, just import `Lottie` and you can get the full benefits of it. 96 97### Objective-C Support 98 99As of 3.0 Lottie has been completely rewritten in Swift! 100 101For Objective-C support please use Lottie 2.5.3. Alternatively an Objective-C branch exists and is still active. 102 103The official objective c branch can be found here: 104 105[Objective-C Branch](https://github.com/airbnb/lottie-ios/tree/lottie/objectiveC) 106 107Also check out the documentation regarding it here: 108 109[iOS Migration](http://airbnb.io/lottie/#/ios-migration) 110