lottie-ios 4.4.2 → 4.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,6 +33,7 @@ jobs:
33
33
  matrix:
34
34
  xcode:
35
35
  - '15.2' # Swift 5.9
36
+ - '15.3' # Swift 5.10
36
37
  steps:
37
38
  - uses: actions/checkout@v2
38
39
  - uses: ./.github/actions/setup
@@ -49,7 +50,7 @@ jobs:
49
50
  - uses: actions/checkout@v2
50
51
  - uses: ./.github/actions/setup
51
52
  with:
52
- xcode: '15.2' # Swift 5.9
53
+ xcode: '15.3' # Swift 5.10
53
54
  - name: Build Example
54
55
  run: bundle exec rake build:example:all
55
56
 
@@ -60,7 +61,7 @@ jobs:
60
61
  - uses: actions/checkout@v2
61
62
  - uses: ./.github/actions/setup
62
63
  with:
63
- xcode: '15.2' # Swift 5.9
64
+ xcode: '15.3' # Swift 5.10
64
65
  - name: Test Package
65
66
  run: bundle exec rake test:package
66
67
  - name: Process test artifacts
@@ -150,7 +151,7 @@ jobs:
150
151
  strategy:
151
152
  matrix:
152
153
  xcode:
153
- - '15.2' # Swift 5.9, first Xcode version with visionOS
154
+ - '15.3' # Swift 5.10
154
155
  steps:
155
156
  - uses: actions/checkout@v2
156
157
  - uses: ./.github/actions/setup
@@ -166,7 +167,7 @@ jobs:
166
167
  strategy:
167
168
  matrix:
168
169
  xcode:
169
- - '15.2' # Swift 5.9
170
+ - '15.3' # Swift 5.10
170
171
  steps:
171
172
  - uses: actions/checkout@v2
172
173
  - uses: ./.github/actions/setup
@@ -185,7 +186,7 @@ jobs:
185
186
  with:
186
187
  install-mint: true
187
188
  install-carthage: true
188
- xcode: '15.2' # Swift 5.9
189
+ xcode: '15.3' # Swift 5.10
189
190
  - name: Test Carthage support
190
191
  run: bundle exec rake test:carthage
191
192
 
package/README.md CHANGED
@@ -41,7 +41,7 @@ To install Lottie using [Swift Package Manager](https://github.com/apple/swift-p
41
41
  or you can add the following dependency to your `Package.swift`:
42
42
 
43
43
  ```swift
44
- .package(url: "https://github.com/airbnb/lottie-spm.git", from: "4.4.2")
44
+ .package(url: "https://github.com/airbnb/lottie-spm.git", from: "4.4.3")
45
45
  ```
46
46
 
47
47
  When using Swift Package Manager we recommend using the [lottie-spm](https://github.com/airbnb/lottie-spm) repo instead of the main lottie-ios repo. The main git repository for [lottie-ios](https://github.com/airbnb/lottie-ios) is somewhat large (300+ MB), and Swift Package Manager always downloads the full repository with all git history. The [lottie-spm](https://github.com/airbnb/lottie-spm) repo is much smaller (less than 500kb), so can be downloaded much more quickly.
@@ -15,7 +15,7 @@
15
15
  <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
16
16
  <key>NSPrivacyAccessedAPITypeReasons</key>
17
17
  <array>
18
- <string>3B52.1</string>
18
+ <string>C617.1</string>
19
19
  </array>
20
20
  </dict>
21
21
  </array>
@@ -537,11 +537,26 @@ extension CoreAnimationLayer: RootAnimationLayer {
537
537
  /// every frame of every animation. For very large animations with a huge number of layers,
538
538
  /// this can be prohibitively expensive.
539
539
  func validateReasonableNumberOfTimeRemappingLayers() throws {
540
+ let numberOfLayersWithTimeRemapping = numberOfLayersWithTimeRemapping
541
+ let numberOfFrames = Int(animation.framerate * animation.duration)
542
+ let totalCost = numberOfLayersWithTimeRemapping * numberOfFrames
543
+
544
+ /// Cap the cost / complexity of animations that use Core Animation time remapping.
545
+ /// - Short, simple animations perform well, but long and complex animations perform poorly.
546
+ /// - We count the total number of frames that will need to be manually interpolated, which is
547
+ /// the number of layers with time remapping enabled times the total number of frames.
548
+ /// - The cap is arbitrary, and is currently:
549
+ /// - 1000 layers for a one second animation at 60fp
550
+ /// - 500 layers for a two second animation at 60fps, etc
551
+ /// - All of the sample animations in the lottie-ios repo below this cap perform well.
552
+ /// If users report animations below this cap that perform poorly, we can lower the cap.
553
+ let maximumAllowedCost = 1000 * 60
554
+
540
555
  try layerContext.compatibilityAssert(
541
- numberOfLayersWithTimeRemapping < 500,
556
+ totalCost < maximumAllowedCost,
542
557
  """
543
- This animation has a very large number of layers with time remapping (\(numberOfLayersWithTimeRemapping)),
544
- so will perform poorly with the Core Animation rendering engine.
558
+ This animation has a very large number of layers with time remapping (\(numberOfLayersWithTimeRemapping) \
559
+ layers over \(numberOfFrames) frames) so will perform poorly with the Core Animation rendering engine.
545
560
  """)
546
561
  }
547
562
 
@@ -125,7 +125,7 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
125
125
  }
126
126
  .sizing(sizing)
127
127
  .configure { context in
128
- applyCurrentAnimationConfiguration(to: context.view)
128
+ applyCurrentAnimationConfiguration(to: context.view, in: context.container)
129
129
  }
130
130
  .configurations(configurations)
131
131
  .opacity(animationSource == nil ? 0 : 1)
@@ -152,14 +152,22 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
152
152
  return copy
153
153
  }
154
154
 
155
- /// Returns a copy of this view that can be resized by scaling its animation to fit the size
156
- /// offered by its parent.
155
+ /// Returns a copy of this view that can be resized by scaling its animation
156
+ /// to always fit the size offered by its parent.
157
157
  public func resizable() -> Self {
158
158
  var copy = self
159
159
  copy.sizing = .proposed
160
160
  return copy
161
161
  }
162
162
 
163
+ /// Returns a copy of this view that adopts the intrinsic size of the animation,
164
+ /// up to the proposed size.
165
+ public func intrinsicSize() -> Self {
166
+ var copy = self
167
+ copy.sizing = .intrinsic
168
+ return copy
169
+ }
170
+
163
171
  @available(*, deprecated, renamed: "playing()", message: "Will be removed in a future major release.")
164
172
  public func play() -> Self {
165
173
  playbackMode(.playing(.fromProgress(nil, toProgress: 1, loopMode: .playOnce)))
@@ -501,7 +509,10 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
501
509
  }
502
510
 
503
511
  /// Applies playback configuration for the current animation to the `LottieAnimationView`
504
- private func applyCurrentAnimationConfiguration(to view: LottieAnimationView) {
512
+ private func applyCurrentAnimationConfiguration(
513
+ to view: LottieAnimationView,
514
+ in container: SwiftUIMeasurementContainer<LottieAnimationView>)
515
+ {
505
516
  guard let animationSource else { return }
506
517
  var imageProviderConfiguration = imageProviderConfiguration
507
518
  var playbackMode = playbackMode
@@ -543,6 +554,10 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
543
554
  if animationSource.animation !== view.animation {
544
555
  view.loadAnimation(animationSource)
545
556
  animationDidLoad?(animationSource)
557
+
558
+ // Invalidate the intrinsic size of the SwiftUI measurement container,
559
+ // since any cached measurements will be out of date after updating the animation.
560
+ container.invalidateIntrinsicContentSize()
546
561
  }
547
562
 
548
563
  if
package/Version.xcconfig CHANGED
@@ -2,5 +2,5 @@
2
2
  // Copyright © 2024 Airbnb Inc. All rights reserved.
3
3
 
4
4
  // The version numbers used when building Lottie.xcframework
5
- MARKETING_VERSION = 4.4.2
6
- CURRENT_PROJECT_VERSION = 442 // a three-digit representation of the marketing version, without dots.
5
+ MARKETING_VERSION = 4.4.3
6
+ CURRENT_PROJECT_VERSION = 443 // a three-digit representation of the marketing version, without dots.
@@ -8,7 +8,7 @@
8
8
 
9
9
  Pod::Spec.new do |s|
10
10
  s.name = 'lottie-ios'
11
- s.version = '4.4.2'
11
+ s.version = '4.4.3'
12
12
  s.summary = 'A library to render native animations from bodymovin json'
13
13
 
14
14
  s.description = <<-DESC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lottie-ios",
3
- "version": "4.4.2",
3
+ "version": "4.4.3",
4
4
  "description": "Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with bodymovin and renders the vector animations natively on mobile and through React Native!",
5
5
  "main": "index.js",
6
6
  "scripts": {