lottie-ios 4.4.1 → 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.
Files changed (37) hide show
  1. package/.github/workflows/main.yml +10 -4
  2. package/Lottie.xcodeproj/project.pbxproj +40 -44
  3. package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  4. package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +18 -0
  5. package/Package.swift +1 -1
  6. package/README.md +1 -1
  7. package/Rakefile +5 -12
  8. package/Sources/PrivacyInfo.xcprivacy +1 -1
  9. package/Sources/Private/CoreAnimation/CoreAnimationLayer.swift +18 -3
  10. package/Sources/Private/EmbeddedLibraries/EpoxyCore/README.md +3 -4
  11. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +0 -1
  12. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +0 -4
  13. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +0 -4
  14. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +0 -4
  15. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +0 -1
  16. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +0 -4
  17. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +0 -1
  18. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +0 -2
  19. package/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +0 -4
  20. package/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +0 -1
  21. package/Sources/Private/Model/DotLottie/DotLottieUtils.swift +3 -5
  22. package/Sources/Private/Utility/Extensions/DataExtension.swift +5 -8
  23. package/Sources/Private/Utility/Extensions/MathKit.swift +2 -2
  24. package/Sources/Private/Utility/Helpers/Binding+Map.swift +0 -1
  25. package/Sources/Private/Utility/Helpers/View+ValueChanged.swift +15 -2
  26. package/Sources/Public/Animation/LottieAnimationHelpers.swift +0 -1
  27. package/Sources/Public/Animation/LottieView.swift +30 -12
  28. package/Sources/Public/Controls/LottieButton.swift +0 -1
  29. package/Sources/Public/Controls/LottieSwitch.swift +0 -1
  30. package/Sources/Public/Controls/LottieViewType.swift +1 -1
  31. package/Sources/Public/DotLottie/DotLottieFileHelpers.swift +0 -5
  32. package/Sources/Public/iOS/LottieAnimationViewBase.swift +1 -5
  33. package/Version.xcconfig +6 -0
  34. package/lottie-ios.podspec +5 -4
  35. package/package.json +1 -1
  36. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift +0 -46
  37. package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift +0 -389
@@ -6,7 +6,6 @@ import SwiftUI
6
6
 
7
7
  // MARK: - View
8
8
 
9
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
10
9
  extension View {
11
10
  /// Applies the layout margins from the parent `EpoxySwiftUIHostingView` to this `View`, if there
12
11
  /// are any.
@@ -22,7 +21,6 @@ extension View {
22
21
 
23
22
  // MARK: - EnvironmentValues
24
23
 
25
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
26
24
  extension EnvironmentValues {
27
25
  /// The layout margins of the parent `EpoxySwiftUIHostingView`, else zero if there is none.
28
26
  var epoxyLayoutMargins: EdgeInsets {
@@ -33,7 +31,6 @@ extension EnvironmentValues {
33
31
 
34
32
  // MARK: - EpoxyLayoutMarginsKey
35
33
 
36
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
37
34
  private struct EpoxyLayoutMarginsKey: EnvironmentKey {
38
35
  static let defaultValue = EdgeInsets()
39
36
  }
@@ -42,7 +39,6 @@ private struct EpoxyLayoutMarginsKey: EnvironmentKey {
42
39
 
43
40
  /// A view modifier that applies the layout margins from an enclosing `EpoxySwiftUIHostingView` to
44
41
  /// the modified `View`.
45
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
46
42
  private struct EpoxyLayoutMarginsPadding: ViewModifier {
47
43
  @Environment(\.epoxyLayoutMargins) var epoxyLayoutMargins
48
44
 
@@ -6,7 +6,6 @@ import SwiftUI
6
6
 
7
7
  // MARK: - StyledView
8
8
 
9
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
10
9
  extension StyledView where Self: ContentConfigurableView & BehaviorsConfigurableView {
11
10
  /// Returns a SwiftUI `View` representing this `EpoxyableView`.
12
11
  ///
@@ -52,7 +51,6 @@ extension StyledView where Self: ContentConfigurableView & BehaviorsConfigurable
52
51
  }
53
52
  }
54
53
 
55
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
56
54
  extension StyledView
57
55
  where
58
56
  Self: ContentConfigurableView & BehaviorsConfigurableView,
@@ -96,7 +94,6 @@ extension StyledView
96
94
  }
97
95
  }
98
96
 
99
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
100
97
  extension StyledView
101
98
  where
102
99
  Self: ContentConfigurableView & BehaviorsConfigurableView,
@@ -138,7 +135,6 @@ extension StyledView
138
135
  }
139
136
  }
140
137
 
141
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
142
138
  extension StyledView
143
139
  where
144
140
  Self: ContentConfigurableView & BehaviorsConfigurableView,
@@ -13,7 +13,6 @@ import SwiftUI
13
13
  /// `sizeThatFits(…)` method.
14
14
  ///
15
15
  /// - SeeAlso: ``SwiftUIMeasurementContainer``
16
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
17
16
  protocol MeasuringViewRepresentable: ViewRepresentableType
18
17
  where
19
18
  RepresentableViewType == SwiftUIMeasurementContainer<Content>
@@ -32,7 +31,6 @@ protocol MeasuringViewRepresentable: ViewRepresentableType
32
31
 
33
32
  // MARK: Extensions
34
33
 
35
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
36
34
  extension MeasuringViewRepresentable {
37
35
  /// Returns a copy of this view with its sizing strategy updated to the given `sizing` value.
38
36
  func sizing(_ strategy: SwiftUIMeasurementContainerStrategy) -> Self {
@@ -45,7 +43,6 @@ extension MeasuringViewRepresentable {
45
43
  // MARK: Defaults
46
44
 
47
45
  #if os(iOS) || os(tvOS)
48
- @available(iOS 13.0, tvOS 13.0, *)
49
46
  extension MeasuringViewRepresentable {
50
47
  func _overrideSizeThatFits(
51
48
  _ size: inout CGSize,
@@ -87,7 +84,6 @@ extension MeasuringViewRepresentable {
87
84
  }
88
85
 
89
86
  #elseif os(macOS)
90
- @available(macOS 10.15, *)
91
87
  extension MeasuringViewRepresentable {
92
88
  func _overrideSizeThatFits(
93
89
  _ size: inout CGSize,
@@ -13,7 +13,6 @@ import SwiftUI
13
13
  /// height through the `SwiftUISizingContext` binding.
14
14
  ///
15
15
  /// - SeeAlso: ``MeasuringViewRepresentable``
16
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
17
16
  final class SwiftUIMeasurementContainer<Content: ViewType>: ViewType {
18
17
 
19
18
  // MARK: Lifecycle
@@ -12,7 +12,6 @@ import SwiftUI
12
12
  ///
13
13
  /// Includes an optional generic `Storage` value, which can be used to compare old and new values
14
14
  /// across state changes to prevent redundant view updates.
15
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
16
15
  struct SwiftUIView<Content: ViewType, Storage>: MeasuringViewRepresentable,
17
16
  UIViewConfiguringSwiftUIView
18
17
  {
@@ -51,7 +50,6 @@ struct SwiftUIView<Content: ViewType, Storage>: MeasuringViewRepresentable,
51
50
 
52
51
  // MARK: UIViewRepresentable
53
52
 
54
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
55
53
  extension SwiftUIView {
56
54
  func makeCoordinator() -> Coordinator {
57
55
  Coordinator(storage: storage)
@@ -98,7 +96,6 @@ extension SwiftUIView {
98
96
 
99
97
  // MARK: SwiftUIView.ConfigurationContext
100
98
 
101
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
102
99
  extension SwiftUIView {
103
100
  /// The configuration context that's available to configure the `Content` view whenever the
104
101
  /// `updateUIView()` method is invoked via a configuration closure.
@@ -130,7 +127,6 @@ extension SwiftUIView {
130
127
 
131
128
  // MARK: SwiftUIView.Coordinator
132
129
 
133
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
134
130
  extension SwiftUIView {
135
131
  /// A coordinator that stores the `storage` associated with this view, enabling the old storage
136
132
  /// value to be accessed during the `updateUIView(…)`.
@@ -6,7 +6,6 @@ import SwiftUI
6
6
 
7
7
  // MARK: - ViewTypeProtocol + swiftUIView
8
8
 
9
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
10
9
  extension ViewTypeProtocol {
11
10
  /// Returns a SwiftUI `View` representing this `UIView`, constructed with the given `makeView`
12
11
  /// closure and sized with the given sizing configuration.
@@ -8,7 +8,6 @@ import SwiftUI
8
8
 
9
9
  /// A protocol describing a SwiftUI `View` that can configure its `UIView` content via an array of
10
10
  /// `configuration` closures.
11
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
12
11
  protocol UIViewConfiguringSwiftUIView: View {
13
12
  /// The context available to this configuration, which provides the `UIView` instance at a minimum
14
13
  /// but can include additional context as needed.
@@ -24,7 +23,6 @@ protocol UIViewConfiguringSwiftUIView: View {
24
23
 
25
24
  // MARK: Extensions
26
25
 
27
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
28
26
  extension UIViewConfiguringSwiftUIView {
29
27
  /// Returns a copy of this view updated to have the given closure applied to its represented view
30
28
  /// whenever it is updated via the `updateUIView(…)` method.
@@ -12,14 +12,12 @@ typealias ViewType = UIView
12
12
 
13
13
  /// The platform's SwiftUI view representable type.
14
14
  /// Either `UIViewRepresentable` on iOS/tvOS or `NSViewRepresentable` on macOS.
15
- @available(iOS 13.0, tvOS 13.0, *)
16
15
  typealias ViewRepresentableType = UIViewRepresentable
17
16
 
18
17
  /// The platform's layout constraint priority type.
19
18
  /// Either `UILayoutPriority` on iOS/tvOS or `NSLayoutConstraint.Priority` on macOS.
20
19
  typealias LayoutPriorityType = UILayoutPriority
21
20
 
22
- @available(iOS 13.0, tvOS 13.0, *)
23
21
  extension ViewRepresentableType {
24
22
  /// The platform's view type for `ViewRepresentableType`.
25
23
  /// Either `UIViewType` on iOS/tvOS or `NSViewType` on macOS.
@@ -35,14 +33,12 @@ typealias ViewType = NSView
35
33
 
36
34
  /// The platform's SwiftUI view representable type.
37
35
  /// Either `UIViewRepresentable` on iOS/tvOS, or `NSViewRepresentable` on macOS.
38
- @available(macOS 10.15, *)
39
36
  typealias ViewRepresentableType = NSViewRepresentable
40
37
 
41
38
  /// The platform's layout constraint priority type.
42
39
  /// Either `UILayoutPriority` on iOS/tvOS, or `NSLayoutConstraint.Priority` on macOS.
43
40
  typealias LayoutPriorityType = NSLayoutConstraint.Priority
44
41
 
45
- @available(macOS 10.15, *)
46
42
  extension ViewRepresentableType {
47
43
  /// The platform's view type for `ViewRepresentableType`.
48
44
  /// Either `UIViewType` on iOS/tvOS or `NSViewType` on macOS.
@@ -184,7 +184,6 @@ final class CoreTextRenderLayer: CALayer {
184
184
  private var needsContentUpdate = false
185
185
 
186
186
  // Draws Debug colors for the font alignment.
187
- @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
188
187
  private func drawDebug(_ ctx: CGContext) {
189
188
  if let font {
190
189
  let ascent = CTFontGetAscent(font)
@@ -15,10 +15,7 @@ enum DotLottieUtils {
15
15
 
16
16
  /// Temp folder to app directory
17
17
  static var tempDirectoryURL: URL {
18
- if #available(iOS 10.0, macOS 10.12, *) {
19
- return FileManager.default.temporaryDirectory
20
- }
21
- return URL(fileURLWithPath: NSTemporaryDirectory())
18
+ FileManager.default.temporaryDirectory
22
19
  }
23
20
  }
24
21
 
@@ -56,7 +53,8 @@ public enum DotLottieError: Error {
56
53
  case noDataLoaded
57
54
  /// Asset with this name was not found in the provided bundle.
58
55
  case assetNotFound(name: String, bundle: Bundle?)
59
- /// Animation loading from asset is not supported on macOS 10.10.
56
+ /// Animation loading from asset was not supported on macOS 10.10,
57
+ /// but this error is no longer used.
60
58
  case loadingFromAssetNotSupported
61
59
 
62
60
  @available(*, deprecated, message: "Unused")
@@ -22,15 +22,12 @@ extension Data {
22
22
  throw DotLottieError.assetNotFound(name: assetName, bundle: bundle)
23
23
  }
24
24
  #else
25
- if #available(macOS 10.11, *) {
26
- if let asset = NSDataAsset(name: assetName, bundle: bundle) {
27
- self = asset.data
28
- return
29
- } else {
30
- throw DotLottieError.assetNotFound(name: assetName, bundle: bundle)
31
- }
25
+ if let asset = NSDataAsset(name: assetName, bundle: bundle) {
26
+ self = asset.data
27
+ return
28
+ } else {
29
+ throw DotLottieError.assetNotFound(name: assetName, bundle: bundle)
32
30
  }
33
- throw DotLottieError.loadingFromAssetNotSupported
34
31
  #endif
35
32
  }
36
33
  }
@@ -272,12 +272,12 @@ extension CGPoint {
272
272
 
273
273
  /// Operator convenience to divide points with /
274
274
  static func / (lhs: CGPoint, rhs: CGFloat) -> CGPoint {
275
- CGPoint(x: lhs.x / CGFloat(rhs), y: lhs.y / CGFloat(rhs))
275
+ CGPoint(x: lhs.x / rhs, y: lhs.y / rhs)
276
276
  }
277
277
 
278
278
  /// Operator convenience to multiply points with *
279
279
  static func * (lhs: CGPoint, rhs: CGFloat) -> CGPoint {
280
- CGPoint(x: lhs.x * CGFloat(rhs), y: lhs.y * CGFloat(rhs))
280
+ CGPoint(x: lhs.x * rhs, y: lhs.y * rhs)
281
281
  }
282
282
 
283
283
  /// Operator convenience to add points with +
@@ -4,7 +4,6 @@
4
4
  #if canImport(SwiftUI)
5
5
  import SwiftUI
6
6
 
7
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
8
7
  extension Binding {
9
8
 
10
9
  /// Helper to transform a `Binding` from one `Value` type to another.
@@ -5,18 +5,31 @@
5
5
  import Combine
6
6
  import SwiftUI
7
7
 
8
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
9
8
  extension View {
10
9
  /// A backwards compatible wrapper for iOS 14 `onChange`
11
10
  @ViewBuilder
12
11
  func valueChanged<T: Equatable>(value: T, onChange: @escaping (T) -> Void) -> some View {
13
- if #available(iOS 14.0, *, macOS 11.0, tvOS 14.0) {
12
+ #if compiler(>=5.9)
13
+ if #available(iOS 17.0, macOS 14.0, tvOS 17.0, visionOS 1.0, *) {
14
+ self.onChange(of: value) { _, newValue in
15
+ onChange(newValue)
16
+ }
17
+ } else if #available(iOS 14.0, macOS 11.0, tvOS 14.0, *) {
18
+ self.onChange(of: value, perform: onChange)
19
+ } else {
20
+ onReceive(Just(value)) { value in
21
+ onChange(value)
22
+ }
23
+ }
24
+ #else
25
+ if #available(iOS 14.0, macOS 11.0, tvOS 14.0, *) {
14
26
  self.onChange(of: value, perform: onChange)
15
27
  } else {
16
28
  onReceive(Just(value)) { value in
17
29
  onChange(value)
18
30
  }
19
31
  }
32
+ #endif
20
33
  }
21
34
  }
22
35
  #endif
@@ -171,7 +171,6 @@ extension LottieAnimation {
171
171
  /// - Parameter url: The url to load the animation from.
172
172
  /// - Parameter animationCache: A cache for holding loaded animations. Defaults to `LottieAnimationCache.shared`. Optional.
173
173
  ///
174
- @available(iOS 13.0, macOS 10.15, tvOS 13.0, *)
175
174
  public static func loadedFrom(
176
175
  url: URL,
177
176
  session: URLSession = .shared,
@@ -7,14 +7,13 @@ import SwiftUI
7
7
  // MARK: - LottieView
8
8
 
9
9
  /// A wrapper which exposes Lottie's `LottieAnimationView` to SwiftUI
10
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
11
10
  public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
12
11
 
13
12
  // MARK: Lifecycle
14
13
 
15
14
  /// Creates a `LottieView` that displays the given animation
16
15
  public init(animation: LottieAnimation?) where Placeholder == EmptyView {
17
- _animationSource = State(initialValue: animation.map(LottieAnimationSource.lottieAnimation))
16
+ localAnimation = animation.map(LottieAnimationSource.lottieAnimation)
18
17
  placeholder = nil
19
18
  }
20
19
 
@@ -29,7 +28,7 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
29
28
  /// }
30
29
  /// ```
31
30
  public init(dotLottieFile: DotLottieFile?) where Placeholder == EmptyView {
32
- _animationSource = State(initialValue: dotLottieFile.map(LottieAnimationSource.dotLottieFile))
31
+ localAnimation = dotLottieFile.map(LottieAnimationSource.dotLottieFile)
33
32
  placeholder = nil
34
33
  }
35
34
 
@@ -107,9 +106,9 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
107
106
  _ loadAnimation: @escaping () async throws -> LottieAnimationSource?,
108
107
  @ViewBuilder placeholder: @escaping () -> Placeholder)
109
108
  {
109
+ localAnimation = nil
110
110
  self.loadAnimation = loadAnimation
111
111
  self.placeholder = placeholder
112
- _animationSource = State(initialValue: nil)
113
112
  }
114
113
 
115
114
  // MARK: Public
@@ -126,7 +125,7 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
126
125
  }
127
126
  .sizing(sizing)
128
127
  .configure { context in
129
- applyCurrentAnimationConfiguration(to: context.view)
128
+ applyCurrentAnimationConfiguration(to: context.view, in: context.container)
130
129
  }
131
130
  .configurations(configurations)
132
131
  .opacity(animationSource == nil ? 0 : 1)
@@ -153,14 +152,22 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
153
152
  return copy
154
153
  }
155
154
 
156
- /// Returns a copy of this view that can be resized by scaling its animation to fit the size
157
- /// 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.
158
157
  public func resizable() -> Self {
159
158
  var copy = self
160
159
  copy.sizing = .proposed
161
160
  return copy
162
161
  }
163
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
+
164
171
  @available(*, deprecated, renamed: "playing()", message: "Will be removed in a future major release.")
165
172
  public func play() -> Self {
166
173
  playbackMode(.playing(.fromProgress(nil, toProgress: 1, loopMode: .playOnce)))
@@ -454,7 +461,8 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
454
461
 
455
462
  // MARK: Private
456
463
 
457
- @State private var animationSource: LottieAnimationSource?
464
+ private let localAnimation: LottieAnimationSource?
465
+ @State private var remoteAnimation: LottieAnimationSource?
458
466
  private var playbackMode: LottiePlaybackMode?
459
467
  private var animationSpeed: Double?
460
468
  private var reloadAnimationTrigger: AnyEquatable?
@@ -474,12 +482,16 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
474
482
  imageProvider: AnimationImageProvider,
475
483
  imageProvidersAreEqual: (AnimationImageProvider, AnimationImageProvider) -> Bool)?
476
484
 
485
+ private var animationSource: LottieAnimationSource? {
486
+ localAnimation ?? remoteAnimation
487
+ }
488
+
477
489
  private func loadAnimationIfNecessary() {
478
490
  guard let loadAnimation else { return }
479
491
 
480
492
  Task {
481
493
  do {
482
- animationSource = try await loadAnimation()
494
+ remoteAnimation = try await loadAnimation()
483
495
  } catch {
484
496
  logger.warn("Failed to load asynchronous Lottie animation with error: \(error)")
485
497
  }
@@ -490,14 +502,17 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
490
502
  guard loadAnimation != nil else { return }
491
503
 
492
504
  if showPlaceholderWhileReloading {
493
- animationSource = nil
505
+ remoteAnimation = nil
494
506
  }
495
507
 
496
508
  loadAnimationIfNecessary()
497
509
  }
498
510
 
499
511
  /// Applies playback configuration for the current animation to the `LottieAnimationView`
500
- private func applyCurrentAnimationConfiguration(to view: LottieAnimationView) {
512
+ private func applyCurrentAnimationConfiguration(
513
+ to view: LottieAnimationView,
514
+ in container: SwiftUIMeasurementContainer<LottieAnimationView>)
515
+ {
501
516
  guard let animationSource else { return }
502
517
  var imageProviderConfiguration = imageProviderConfiguration
503
518
  var playbackMode = playbackMode
@@ -539,6 +554,10 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
539
554
  if animationSource.animation !== view.animation {
540
555
  view.loadAnimation(animationSource)
541
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()
542
561
  }
543
562
 
544
563
  if
@@ -564,7 +583,6 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
564
583
  }
565
584
  }
566
585
 
567
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
568
586
  extension View {
569
587
 
570
588
  /// The `.overlay` modifier that uses a `ViewBuilder` is available in iOS 15+, this helper function helps us to use the same API in older OSs
@@ -5,7 +5,6 @@
5
5
  import SwiftUI
6
6
 
7
7
  /// A wrapper which exposes Lottie's `AnimatedButton` to SwiftUI
8
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
9
8
  public struct LottieButton: UIViewConfiguringSwiftUIView {
10
9
 
11
10
  // MARK: Lifecycle
@@ -5,7 +5,6 @@
5
5
  import SwiftUI
6
6
 
7
7
  /// A wrapper which exposes Lottie's `AnimatedSwitch` to SwiftUI
8
- @available(iOS 13.0, tvOS 13.0, macOS 10.15, *)
9
8
  public struct LottieSwitch: UIViewConfiguringSwiftUIView {
10
9
 
11
10
  // MARK: Lifecycle
@@ -44,7 +44,7 @@ public enum LottieNSControlState: UInt, RawRepresentable {
44
44
  /// - `UIControl.Event` on iOS / tvOS and `LottieNSControlEvent` on macOS.
45
45
  public typealias LottieControlEvent = LottieNSControlEvent
46
46
 
47
- public struct LottieNSControlEvent: Equatable {
47
+ public struct LottieNSControlEvent: Equatable, Sendable {
48
48
 
49
49
  // MARK: Lifecycle
50
50
 
@@ -118,7 +118,6 @@ extension DotLottieFile {
118
118
  /// - Parameter bundle: The bundle in which the lottie is located. Defaults to `Bundle.main`
119
119
  /// - Parameter subdirectory: A subdirectory in the bundle in which the lottie is located. Optional.
120
120
  /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional.
121
- @available(iOS 13.0, macOS 10.15, tvOS 13.0, *)
122
121
  public static func named(
123
122
  _ name: String,
124
123
  bundle: Bundle = Bundle.main,
@@ -165,7 +164,6 @@ extension DotLottieFile {
165
164
  /// Loads an DotLottie from a specific filepath.
166
165
  /// - Parameter filepath: The absolute filepath of the lottie to load. EG "/User/Me/starAnimation.lottie"
167
166
  /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional.
168
- @available(iOS 13.0, macOS 10.15, tvOS 13.0, *)
169
167
  public static func loadedFrom(
170
168
  filepath: String,
171
169
  dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache)
@@ -204,7 +202,6 @@ extension DotLottieFile {
204
202
  /// - Parameter name: The name of the lottie file in the asset catalog. EG "StarAnimation"
205
203
  /// - Parameter bundle: The bundle in which the lottie is located. Defaults to `Bundle.main`
206
204
  /// - Parameter dotLottieCache: A cache for holding loaded lottie files. Defaults to `LRUDotLottieCache.sharedCache` Optional.
207
- @available(iOS 13.0, macOS 10.15, tvOS 13.0, *)
208
205
  public static func asset(
209
206
  named name: String,
210
207
  bundle: Bundle = Bundle.main,
@@ -270,7 +267,6 @@ extension DotLottieFile {
270
267
  ///
271
268
  /// - Parameter url: The url to load the animation from.
272
269
  /// - Parameter animationCache: A cache for holding loaded animations. Defaults to `LRUAnimationCache.sharedCache`. Optional.
273
- @available(iOS 13.0, macOS 10.15, tvOS 13.0, *)
274
270
  public static func loadedFrom(
275
271
  url: URL,
276
272
  session: URLSession = .shared,
@@ -354,7 +350,6 @@ extension DotLottieFile {
354
350
  /// - data: The data(`Foundation.Data`) object to load DotLottie from
355
351
  /// - filename: The name of the lottie file without the lottie extension. eg. "StarAnimation"
356
352
  /// - dispatchQueue: A dispatch queue used to load animations. Defaults to `DispatchQueue.global()`. Optional.
357
- @available(iOS 13.0, macOS 10.15, tvOS 13.0, *)
358
353
  public static func loadedFrom(
359
354
  data: Data,
360
355
  filename: String,
@@ -39,11 +39,7 @@ open class LottieAnimationViewBase: UIView {
39
39
 
40
40
  var screenScale: CGFloat {
41
41
  #if os(iOS) || os(tvOS)
42
- if #available(iOS 13.0, tvOS 13.0, *) {
43
- return max(UITraitCollection.current.displayScale, 1)
44
- } else {
45
- return UIScreen.main.scale
46
- }
42
+ max(UITraitCollection.current.displayScale, 1)
47
43
  #else // if os(visionOS)
48
44
  // We intentionally don't check `#if os(visionOS)`, because that emits
49
45
  // a warning when building on Xcode 14 and earlier.
@@ -0,0 +1,6 @@
1
+ // Created by Cal Stephens on 3/12/24.
2
+ // Copyright © 2024 Airbnb Inc. All rights reserved.
3
+
4
+ // The version numbers used when building Lottie.xcframework
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.1'
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
@@ -23,9 +23,10 @@ Lottie enables designers to create and ship beautiful animations without an engi
23
23
  s.source = { :git => 'https://github.com/airbnb/lottie-ios.git', :tag => s.version.to_s }
24
24
 
25
25
  s.swift_version = '5.7'
26
- s.ios.deployment_target = '11.0'
27
- s.osx.deployment_target = '10.12'
28
- s.tvos.deployment_target = '11.0'
26
+ s.ios.deployment_target = '13.0'
27
+ s.osx.deployment_target = '10.15'
28
+ s.tvos.deployment_target = '13.0'
29
+ s.visionos.deployment_target = "1.0"
29
30
 
30
31
  s.source_files = 'Sources/**/*.swift'
31
32
  s.resource_bundles = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lottie-ios",
3
- "version": "4.4.1",
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": {
@@ -1,46 +0,0 @@
1
- // Created by eric_horacek on 10/8/21.
2
- // Copyright © 2021 Airbnb Inc. All rights reserved.
3
-
4
- #if canImport(SwiftUI) && !os(macOS)
5
- import SwiftUI
6
-
7
- // MARK: - EpoxySwiftUIUIHostingController
8
-
9
- /// A `UIHostingController` that hosts SwiftUI views within an Epoxy container, e.g. an Epoxy
10
- /// `CollectionView`.
11
- ///
12
- /// Exposed internally to allow consumers to reason about these view controllers, e.g. to opt
13
- /// collection view cells out of automated view controller impression tracking.
14
- ///
15
- /// - SeeAlso: `EpoxySwiftUIHostingView`
16
- @available(iOS 13.0, tvOS 13.0, *)
17
- open class EpoxySwiftUIHostingController<Content: View>: UIHostingController<Content> {
18
-
19
- // MARK: Lifecycle
20
-
21
- /// Creates a `UIHostingController` that optionally ignores the `safeAreaInsets` when laying out
22
- /// its contained `RootView`.
23
- convenience init(rootView: Content, ignoreSafeArea: Bool) {
24
- self.init(rootView: rootView)
25
-
26
- // We unfortunately need to call a private API to disable the safe area. We can also accomplish
27
- // this by dynamically subclassing this view controller's view at runtime and overriding its
28
- // `safeAreaInsets` property and returning `.zero`. An implementation of that logic is
29
- // available in this file in the `2d28b3181cca50b89618b54836f7a9b6e36ea78e` commit if this API
30
- // no longer functions in future SwiftUI versions.
31
- _disableSafeArea = ignoreSafeArea
32
- }
33
-
34
- // MARK: Open
35
-
36
- open override func viewDidLoad() {
37
- super.viewDidLoad()
38
-
39
- // A `UIHostingController` has a system background color by default as it's typically used in
40
- // full-screen use cases. Since we're using this view controller to place SwiftUI views within
41
- // other view controllers we default the background color to clear so we can see the views
42
- // below, e.g. to draw highlight states in a `CollectionView`.
43
- view.backgroundColor = .clear
44
- }
45
- }
46
- #endif