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 |
|
6 | Lottie is a mobile library for Android and iOS that natively renders vector based animations and art in realtime with minimal code.
|
7 |
|
8 | Lottie 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 |
|
10 | For the first time, designers can create **and ship** beautiful animations without an engineer painstakingly recreating it by hand.
|
11 | Since the animation is backed by JSON they are extremely small in size but can be large in complexity!
|
12 | Animations can be played, resized, looped, sped up, slowed down, reversed, and even interactively scrubbed.
|
13 | Lottie can play or loop just a portion of the animation as well, the possibilities are endless!
|
14 | Animations can even be ***changed at runtime*** in various ways! Change the color, position or any keyframable value!
|
15 | Lottie also supports native UIViewController Transitions out of the box!
|
16 |
|
17 | Here 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
|
29 | Lottie 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 |
|
32 | You 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
|
35 | Add the pod to your Podfile:
|
36 | ```ruby
|
37 | pod 'lottie-ios'
|
38 | ```
|
39 |
|
40 | And then run:
|
41 | ```ruby
|
42 | pod install
|
43 | ```
|
44 | After installing the cocoapod into your project import Lottie with
|
45 | ```swift
|
46 | import Lottie
|
47 | ```
|
48 | ### Carthage
|
49 | Add Lottie to your Cartfile:
|
50 | ```
|
51 | github "airbnb/lottie-ios" "master"
|
52 | ```
|
53 |
|
54 | And then run:
|
55 | ```
|
56 | carthage update
|
57 | ```
|
58 | In 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 |
|
64 | import PackageDescription
|
65 |
|
66 | let 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 | ```
|
79 | And then import wherever needed: ```import Lottie```
|
80 |
|
81 | #### Adding it to an existent iOS Project via Swift Package Manager
|
82 |
|
83 | 1. Using Xcode 11 go to File > Swift Packages > Add Package Dependency
|
84 | 2. Paste the project URL: https://github.com/airbnb/lottie-ios
|
85 | 3. Click on next and select the project target
|
86 | 4. Don't forget to set `DEAD_CODE_STRIPPING = NO` in your `Build Settings` (https://bugs.swift.org/plugins/servlet/mobile#issue/SR-11564)
|
87 | **NOTE: For MacOS you must set the `Branch` field to `lottie/macos-spm`
|
88 | ![Example](_Gifs/spm-branch.png)
|
89 |
|
90 | If you have doubts, please, check the following links:
|
91 |
|
92 | [How to use](https://developer.apple.com/videos/play/wwdc2019/408/)
|
93 |
|
94 | [Creating Swift Packages](https://developer.apple.com/videos/play/wwdc2019/410/)
|
95 |
|
96 | After successfully retrieved the package and added it to your project, just import `Lottie` and you can get the full benefits of it.
|
97 |
|
98 | -----
|
99 |
|
100 | ### Objective-C Support
|
101 |
|
102 | As of 3.0 Lottie has been completely rewritten in Swift!
|
103 |
|
104 | For Objective-C support please use Lottie 2.5.3. Alternatively an Objective-C branch exists and is still active.
|
105 |
|
106 | The official objective c branch can be found here:
|
107 |
|
108 | [Objective-C Branch](https://github.com/airbnb/lottie-ios/tree/lottie/objectiveC)
|
109 |
|
110 | Also check out the documentation regarding it here:
|
111 |
|
112 | [iOS Migration](http://airbnb.io/lottie/#/ios-migration)
|
113 |
|
114 | ### Data collection
|
115 |
|
116 | The Lottie SDK does not collect any data. We provide this notice to help you fill out [App Privacy Details](https://developer.apple.com/app-store/app-privacy-details/).
|
117 |
|
\ | No newline at end of file |