Skip to content

Commit

Permalink
Adopt policy on minimum supported Swift / Xcode version, update minim…
Browse files Browse the repository at this point in the history
…um versions to Swift 5.7 / Xcode 14.1 (airbnb#2260)
  • Loading branch information
calda authored and Igor Moroz committed May 22, 2024
1 parent 9d8d47e commit fbd0d79
Show file tree
Hide file tree
Showing 73 changed files with 235 additions and 248 deletions.
42 changes: 6 additions & 36 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,14 @@ on:
branches: [ master ]

jobs:
build-package-macos-12:
name: "Build Package"
runs-on: macos-12
strategy:
fail-fast: false
matrix:
xcode:
- '13.4.1' # Swift 5.6
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
with:
xcode: ${{ matrix.xcode }}
- name: Build Package
run: SKIP_VISION_OS=true bundle exec rake build:package:all

build-package-macos-13:
name: "Build Package"
runs-on: macos-13
strategy:
fail-fast: false
matrix:
xcode:
- '14.2' # Swift 5.7
- '14.1' # Swift 5.7
- '14.3' # Swift 5.8
- '15.0' # Swift 5.9
steps:
Expand Down Expand Up @@ -88,16 +72,18 @@ jobs:
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_TOKEN }}
PR_NUMBER: ${{ github.event.number }}

build-xcframework-macos-12:
build-xcframework-macos-13:
name: "Build XCFramework"
runs-on: macos-12
runs-on: macos-13
strategy:
matrix:
xcode:
# XCFrameworks are forwards-compatible but not backwards-compatible.
# The Xcode version we use for this job is that oldest Xcode version that
# will be able to use these XCFrameworks and the lottie-spm package.
- '13.4.1' # Swift 5.6.1
# This should be the minimum Xcode version permitted by the App Store.
# As of April 2023, this is Xcode 14.1: https://developer.apple.com/news/?id=jd9wcyov
- '14.1' # Swift 5.7.1
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
Expand Down Expand Up @@ -162,22 +148,6 @@ jobs:
- name: Test Swift Package Manager support
run: SKIP_VISION_OS=true bundle exec rake test:spm

spm-xcode-13:
name: "Test Swift Package Manager"
runs-on: macos-12
strategy:
matrix:
xcode:
- '13.4.1' # Swift 5.6
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
with:
install-mint: true
xcode: ${{ matrix.xcode }}
- name: Test Swift Package Manager support
run: SKIP_VISION_OS=true bundle exec rake test:spm

carthage:
name: "Test Carthage support"
runs-on: macos-13
Expand Down
42 changes: 20 additions & 22 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
{
"object": {
"pins": [
{
"package": "AirbnbSwift",
"repositoryURL": "https://github.com/airbnb/swift",
"state": {
"branch": null,
"revision": "b408d36b4f5e73ea75441fb9791b849b0a40f58b",
"version": "1.0.5"
}
},
{
"package": "swift-argument-parser",
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "df9ee6676cd5b3bf5b330ec7568a5644f547201b",
"version": "1.1.3"
}
"pins" : [
{
"identity" : "swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/airbnb/swift",
"state" : {
"revision" : "bc6aa7c3e21b6ab951ce75afc0a6e6d16fd6caef",
"version" : "1.0.6"
}
]
},
"version": 1
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "df9ee6676cd5b3bf5b330ec7568a5644f547201b",
"version" : "1.1.3"
}
}
],
"version" : 2
}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.6
// swift-tools-version:5.7
import PackageDescription

let package = Package(
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ carthage update
```
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.

### Data collection
## Swift Version Support

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/).
Lottie supports Swift / Xcode versions back to the minimum version that is permited by Apple for submissions to the App Store. You can see the most up-to-date information for which Swift versions Lottie supports on [Swift Package Index](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)

## Privacy

Lottie 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/). We additionally provide a [privacy manifest](https://github.com/airbnb/lottie-ios/blob/master/PrivacyInfo.xcprivacy) which can be included in your app.

## Contributing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct BezierPathKeyframe {
-> KeyframeGroup<BezierPathKeyframe>
{
guard
let cornerRadius = cornerRadius,
let cornerRadius,
cornerRadius.keyframes.contains(where: { $0.value.cgFloatValue > 0 })
else {
return path.map { path in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ extension LayerProperty {
.init(
caLayerKeypath: #keyPath(CALayer.transform),
isDefaultValue: { transform in
guard let transform = transform else { return false }
guard let transform else { return false }
return CATransform3DIsIdentity(transform)
},
customizableProperty: nil /* currently unsupported */ )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ extension TransformModel {
/// Whether or not this transform has a non-zero skew value
var hasSkew: Bool {
guard
let _skew = _skew,
let _skewAxis = _skewAxis,
let _skew,
let _skewAxis,
!_skew.keyframes.isEmpty,
!_skewAxis.keyframes.isEmpty
else {
Expand All @@ -320,8 +320,8 @@ extension TransformModel {
var hasSkewAnimation: Bool {
guard
hasSkew,
let _skew = _skew,
let _skewAxis = _skewAxis
let _skew,
let _skewAxis
else { return false }

return _skew.keyframes.count > 1
Expand Down
2 changes: 1 addition & 1 deletion Sources/Private/CoreAnimation/CoreAnimationLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ final class CoreAnimationLayer: BaseAnimationLayer {
// allocate a very large amount of memory (400mb+).
// - Alternatively this layer could subclass `CATransformLayer`,
// but this causes Core Animation to emit unnecessary logs.
if var pendingAnimationConfiguration = pendingAnimationConfiguration {
if var pendingAnimationConfiguration {
pendingAnimationConfigurationModification?(&pendingAnimationConfiguration.animationConfiguration)
pendingAnimationConfigurationModification = nil
self.pendingAnimationConfiguration = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extension CALayer {
/// without setting `frame` (which is not permitted if the layer can rotate)
@nonobjc
func fillBoundsOfSuperlayer() {
guard let superlayer = superlayer else { return }
guard let superlayer else { return }

if let customLayerLayer = self as? CustomLayoutLayer {
customLayerLayer.layout(superlayerBounds: superlayer.bounds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extension CALayer {

// Create the `mask` layer for this layer, if it has a `MatteType`
if
let mask = mask,
let mask,
let maskLayer = try maskLayer(for: mask.model, type: mask.matteType, context: context)
{
let maskParentTransformLayer = makeParentTransformLayer(
Expand Down Expand Up @@ -138,7 +138,7 @@ extension CALayer {

}

extension Collection where Element == LayerModel {
extension Collection<LayerModel> {
/// Pairs each `LayerModel` within this array with
/// a `LayerModel` to use as its mask, if applicable
/// based on the layer's `MatteType` configuration.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Private/CoreAnimation/Layers/ImageLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extension ImageLayer: CustomLayoutLayer {
func layout(superlayerBounds: CGRect) {
anchorPoint = .zero

guard let imageAsset = imageAsset else {
guard let imageAsset else {
bounds = superlayerBounds
return
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Private/CoreAnimation/Layers/PreCompLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ final class PreCompLayer: BaseCompositionLayer {
// Precomp layers can adjust the local time of their child layers (relative to the
// animation's global time) via `timeRemapping` or a custom `startTime` / `timeStretch`
let contextForChildren = context.withTimeRemapping { [preCompLayer, timeRemappingInterpolator] layerLocalFrame in
if let timeRemappingInterpolator = timeRemappingInterpolator {
if let timeRemappingInterpolator {
return timeRemappingInterpolator.value(frame: layerLocalFrame) as? AnimationFrameTime ?? layerLocalFrame
} else {
return (layerLocalFrame * AnimationFrameTime(preCompLayer.timeStretch)) + AnimationFrameTime(preCompLayer.startTime)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Private/CoreAnimation/Layers/ShapeItemLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final class ShapeItemLayer: BaseAnimationLayer {
override func setupAnimations(context: LayerAnimationContext) throws {
try super.setupAnimations(context: context)

guard let sublayerConfiguration = sublayerConfiguration else { return }
guard let sublayerConfiguration else { return }

switch sublayerConfiguration.fill {
case .solidFill(let shapeLayer):
Expand Down Expand Up @@ -299,7 +299,7 @@ final class ShapeItemLayer: BaseAnimationLayer {

// MARK: - [ShapeItem] helpers

extension Array where Element == ShapeItemLayer.Item {
extension [ShapeItemLayer.Item] {
/// The first `ShapeItem` in this array of the given type
func first<ItemType: ShapeItem>(
_: ItemType.Type,
Expand Down
2 changes: 1 addition & 1 deletion Sources/Private/CoreAnimation/Layers/ShapeLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ struct ShapeRenderGroup {
var otherItems: [ShapeItemLayer.Item] = []
}

extension Array where Element == ShapeItemLayer.Item {
extension [ShapeItemLayer.Item] {
/// Splits this list of `ShapeItem`s into groups that should be rendered together as individual units,
/// plus the remaining items that were not included in any group.
/// - groupHasChildGroupsToInheritUnusedItems: whether or not this group has child groups
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ enum EpoxyModelArrayBuilder<Model> {
}

static func buildExpression(_ expression: Expression?) -> Component {
if let expression = expression {
if let expression {
return [expression]
}
return []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ extension EpoxyModelProperty.UpdateStrategy {
/// calls the old closure and then subsequently calls the new closure.
static func chain() -> EpoxyModelProperty<(() -> Void)?>.UpdateStrategy {
.init { old, new in
guard let new = new else { return old }
guard let old = old else { return new }
guard let new else { return old }
guard let old else { return new }
return {
old()
new()
Expand All @@ -106,8 +106,8 @@ extension EpoxyModelProperty.UpdateStrategy {
/// calls the old closure and then subsequently calls the new closure.
static func chain<A>() -> EpoxyModelProperty<((A) -> Void)?>.UpdateStrategy {
.init { old, new in
guard let new = new else { return old }
guard let old = old else { return new }
guard let new else { return old }
guard let old else { return new }
return { a in
old(a)
new(a)
Expand All @@ -119,8 +119,8 @@ extension EpoxyModelProperty.UpdateStrategy {
/// calls the old closure and then subsequently calls the new closure.
static func chain<A, B>() -> EpoxyModelProperty<((A, B) -> Void)?>.UpdateStrategy {
.init { old, new in
guard let new = new else { return old }
guard let old = old else { return new }
guard let new else { return old }
guard let old else { return new }
return { a, b in
old(a, b)
new(a, b)
Expand All @@ -132,8 +132,8 @@ extension EpoxyModelProperty.UpdateStrategy {
/// calls the old closure and then subsequently calls the new closure.
static func chain<A, B, C>() -> EpoxyModelProperty<((A, B, C) -> Void)?>.UpdateStrategy {
.init { old, new in
guard let new = new else { return old }
guard let old = old else { return new }
guard let new else { return old }
guard let old else { return new }
return { a, b, c in
old(a, b, c)
new(a, b, c)
Expand All @@ -145,8 +145,8 @@ extension EpoxyModelProperty.UpdateStrategy {
/// calls the old closure and then subsequently calls the new closure.
static func chain<A, B, C, D>() -> EpoxyModelProperty<((A, B, C, D) -> Void)?>.UpdateStrategy {
.init { old, new in
guard let new = new else { return old }
guard let old = old else { return new }
guard let new else { return old }
guard let old else { return new }
return { a, b, c, d in
old(a, b, c, d)
new(a, b, c, d)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Private/EmbeddedLibraries/LRUCache/LRUCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ final class LRUCache<Key: Hashable, Value> {
}

deinit {
if let token = token {
if let token {
notificationCenter.removeObserver(token)
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ extension LRUCache {

/// Insert a value into the cache with optional `cost`
func setValue(_ value: Value?, forKey key: Key, cost: Int = 0) {
guard let value = value else {
guard let value else {
removeValue(forKey: key)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ extension Archive {
}
case .directory:
_ = try provider(0, 0)
if let progress = progress { progress.completedUnitCount = progress.totalUnitCount }
if let progress { progress.completedUnitCount = progress.totalUnitCount }
case .symlink:
let (linkSizeWritten, linkChecksum) = try writeSymbolicLink(
size: Int(uncompressedSize),
provider: provider)
(sizeWritten, checksum) = (Int64(linkSizeWritten), linkChecksum)
if let progress = progress { progress.completedUnitCount = progress.totalUnitCount }
if let progress { progress.completedUnitCount = progress.totalUnitCount }
}
return (sizeWritten, checksum)
}
Expand Down
Loading

0 comments on commit fbd0d79

Please sign in to comment.