-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set up new SPM package and configure CI #1
Conversation
@@ -0,0 +1,16 @@ | |||
name: Setup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set up CI for this repo using mostly the same configuration as the main lottie-ios repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't enable GitHub actions until we make the repo public. We could either merge this now and verify it works in a follow-up, or remove it from this PR and add it in a separate PR once the repo is public. I'll leave it in for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to leave it in
with: | ||
xcode: ${{ matrix.xcode }} | ||
- name: Build Package | ||
run: bundle exec rake test:package:all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We build the lottie-spm package for all platforms (iOS, macOS, tvOS) and verify that a test target is able to import Lottie as expected
.github/workflows/main.yml
Outdated
- uses: actions/checkout@v2 | ||
- uses: ./.github/actions/setup | ||
- name: Build Example | ||
run: bundle exec rake build:example:all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also include an example app that depends on this lottie-spm package and displays a single Lottie animation
@@ -0,0 +1,48 @@ | |||
# Lottie for Swift Package Manager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied this initial section of the readme from the lottie-ios repo
README.md
Outdated
|
||
![Abcs](https://github.com/airbnb/lottie-ios/blob/master/_Gifs/Examples4.gif) | ||
|
||
## Swift Package Manager support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following content is new and unique to this repo:
.binaryTarget( | ||
name: "Lottie", | ||
url: "https://github.com/airbnb/lottie-ios/releases/download/4.0.1/Lottie.xcframework.zip", | ||
checksum: "b6d8b0b81975d91965b8bb00cffb0eae4b3d94538b6950a90bc1366afd5d4239"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package just points to the XCFramework attached to the latest release: https://github.com/airbnb/lottie-ios/releases/latest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@calda LGTM! Just a few suggestions/questions
import UIKit | ||
import Lottie | ||
|
||
class ViewController: UIViewController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to have a full Xcode project for this? Or could we have a simpler project e.g. an example package that depends on the Lottie package via a relative path and has this same code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we could use a tool like https://github.com/yonaskolb/XcodeGen with its SPM support to generate a minimal Xcode project just to run the tests? That way we would need a bunch of extra files in this repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's nice to include a functional app project in this repo so we can:
- demonstrate how the integration flow works in a real-world use case (an iOS app project)
- have a CI test case for this flow
We also need an Xcode project to run SPM tests for platforms other than macOS (afaik, at least this was the case when I set up CI in the main Lottie repo). We could use XcodeGen for this, but it seems simpler to use a non-generated project since there are other benefits to this setup as well (demonstrating and testing an example iOS app).
Are there any particular downsides of including an Xcode project that you have in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly just hoping it is straightforward to keep this repo up to date since it does add some extra maintenance burden, but if it's also serving as a minimal example then it's probably fine to keep—thought it was just to test
@@ -0,0 +1,52 @@ | |||
# Lottie for Swift Package Manager | |||
[![SwiftPM](https://img.shields.io/badge/SPM-supported-DE5C43.svg?style=flat)](https://swift.org/package-manager/) [![License](https://img.shields.io/cocoapods/l/lottie-ios.svg?style=flat)](https://cocoapods.org/pods/lottie-ios) [![Platform](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fairbnb%2Flottie-ios%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/airbnb/lottie-ios) [![Swift Versions](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fairbnb%2Flottie-ios%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/airbnb/lottie-ios) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be useful to add a bold/highlighted note at the top about how this is different from the main Lottie iOS repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I removed the intro section so the import content is above the fold.
This PR sets up the new SPM package and configures CI for this repo.
Instead of depending on the ~300MB lottie-ios repo, consumers can instead depend on this repo (less than 500KB) that wraps the XCFramework remote binary dependency published in the latest release.