lottie-ios 4.3.2 → 4.3.4
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.
- package/Lottie.xcodeproj/project.pbxproj +20 -0
- package/Lottie.xcodeproj/xcuserdata/calstephens.xcuserdatad/xcschemes/xcschememanagement.plist +4 -4
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +204 -81
- package/Package.swift +1 -0
- package/README.md +1 -1
- package/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift +98 -30
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift +1 -1
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift +1 -3
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +2 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +2 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +2 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +2 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +2 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +2 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +2 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +2 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +2 -1
- package/Sources/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +256 -0
- package/Sources/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
- package/Sources/Private/EmbeddedLibraries/README.md +14 -0
- package/Sources/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +11 -5
- package/Sources/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +0 -1
- package/Sources/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +5 -2
- package/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift +2 -2
- package/Sources/Private/Model/Layers/LayerModel.swift +5 -0
- package/Sources/Private/Utility/Helpers/Binding+Map.swift +2 -0
- package/Sources/Private/Utility/Helpers/View+ValueChanged.swift +2 -0
- package/Sources/Public/Animation/LottieAnimationLayer.swift +5 -0
- package/Sources/Public/Animation/LottieAnimationView.swift +12 -1
- package/Sources/Public/Animation/LottieView.swift +2 -0
- package/Sources/Public/AnimationCache/DefaultAnimationCache.swift +10 -6
- package/Sources/Public/Controls/LottieButton.swift +2 -1
- package/Sources/Public/Controls/LottieSwitch.swift +2 -0
- package/Sources/Public/DotLottie/Cache/DotLottieCache.swift +8 -4
- package/Sources/Public/DotLottie/DotLottieFileHelpers.swift +12 -5
- package/Sources/Public/iOS/LottieAnimationViewBase.swift +5 -2
- package/lottie-ios.podspec +2 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Created by Cal Stephens on 8/14/23.
|
|
2
2
|
// Copyright © 2023 Airbnb Inc. All rights reserved.
|
|
3
3
|
|
|
4
|
+
#if canImport(SwiftUI)
|
|
4
5
|
import SwiftUI
|
|
5
6
|
|
|
6
7
|
/// A wrapper which exposes Lottie's `AnimatedButton` to SwiftUI
|
|
@@ -118,5 +119,5 @@ public struct LottieButton: UIViewConfiguringSwiftUIView {
|
|
|
118
119
|
private let animation: LottieAnimation?
|
|
119
120
|
private let action: () -> Void
|
|
120
121
|
private var configuration: LottieConfiguration = .shared
|
|
121
|
-
|
|
122
122
|
}
|
|
123
|
+
#endif
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Created by Cal Stephens on 8/11/23.
|
|
2
2
|
// Copyright © 2023 Airbnb Inc. All rights reserved.
|
|
3
3
|
|
|
4
|
+
#if canImport(SwiftUI)
|
|
4
5
|
import SwiftUI
|
|
5
6
|
|
|
6
7
|
/// A wrapper which exposes Lottie's `AnimatedSwitch` to SwiftUI
|
|
@@ -142,3 +143,4 @@ public struct LottieSwitch: UIViewConfiguringSwiftUIView {
|
|
|
142
143
|
private var isOn: Binding<Bool>?
|
|
143
144
|
|
|
144
145
|
}
|
|
146
|
+
#endif
|
|
@@ -33,21 +33,25 @@ public class DotLottieCache: DotLottieCacheProvider {
|
|
|
33
33
|
|
|
34
34
|
/// Clears the Cache.
|
|
35
35
|
public func clearCache() {
|
|
36
|
-
cache.
|
|
36
|
+
cache.removeAllValues()
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
public func file(forKey key: String) -> DotLottieFile? {
|
|
40
|
-
cache.
|
|
40
|
+
cache.value(forKey: key)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
public func setFile(_ lottie: DotLottieFile, forKey key: String) {
|
|
44
|
-
cache.
|
|
44
|
+
cache.setValue(lottie, forKey: key)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// MARK: Private
|
|
48
48
|
|
|
49
49
|
private static let defaultCacheCountLimit = 100
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
/// The underlying storage of this cache.
|
|
52
|
+
/// - We use the `LRUCache` library instead of `NSCache`, because `NSCache`
|
|
53
|
+
/// clears all cached values when the app is backgrounded instead of
|
|
54
|
+
/// only when the app receives a memory warning notification.
|
|
55
|
+
private var cache = LRUCache<String, DotLottieFile>()
|
|
52
56
|
|
|
53
57
|
}
|
|
@@ -146,7 +146,7 @@ extension DotLottieFile {
|
|
|
146
146
|
bundle: Bundle = Bundle.main,
|
|
147
147
|
subdirectory: String? = nil,
|
|
148
148
|
dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache,
|
|
149
|
-
dispatchQueue: DispatchQueue = .
|
|
149
|
+
dispatchQueue: DispatchQueue = .dotLottie,
|
|
150
150
|
handleResult: @escaping (Result<DotLottieFile, Error>) -> Void)
|
|
151
151
|
{
|
|
152
152
|
dispatchQueue.async {
|
|
@@ -186,7 +186,7 @@ extension DotLottieFile {
|
|
|
186
186
|
public static func loadedFrom(
|
|
187
187
|
filepath: String,
|
|
188
188
|
dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache,
|
|
189
|
-
dispatchQueue: DispatchQueue = .
|
|
189
|
+
dispatchQueue: DispatchQueue = .dotLottie,
|
|
190
190
|
handleResult: @escaping (Result<DotLottieFile, Error>) -> Void)
|
|
191
191
|
{
|
|
192
192
|
dispatchQueue.async {
|
|
@@ -228,7 +228,7 @@ extension DotLottieFile {
|
|
|
228
228
|
named name: String,
|
|
229
229
|
bundle: Bundle = Bundle.main,
|
|
230
230
|
dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache,
|
|
231
|
-
dispatchQueue: DispatchQueue = .
|
|
231
|
+
dispatchQueue: DispatchQueue = .dotLottie,
|
|
232
232
|
handleResult: @escaping (Result<DotLottieFile, Error>) -> Void)
|
|
233
233
|
{
|
|
234
234
|
dispatchQueue.async {
|
|
@@ -331,7 +331,7 @@ extension DotLottieFile {
|
|
|
331
331
|
public static func loadedFrom(
|
|
332
332
|
data: Data,
|
|
333
333
|
filename: String,
|
|
334
|
-
dispatchQueue: DispatchQueue = .
|
|
334
|
+
dispatchQueue: DispatchQueue = .dotLottie,
|
|
335
335
|
handleResult: @escaping (Result<DotLottieFile, Error>) -> Void)
|
|
336
336
|
{
|
|
337
337
|
dispatchQueue.async {
|
|
@@ -358,7 +358,7 @@ extension DotLottieFile {
|
|
|
358
358
|
public static func loadedFrom(
|
|
359
359
|
data: Data,
|
|
360
360
|
filename: String,
|
|
361
|
-
dispatchQueue: DispatchQueue = .
|
|
361
|
+
dispatchQueue: DispatchQueue = .dotLottie)
|
|
362
362
|
async throws -> DotLottieFile
|
|
363
363
|
{
|
|
364
364
|
try await withCheckedThrowingContinuation { continuation in
|
|
@@ -367,5 +367,12 @@ extension DotLottieFile {
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
+
}
|
|
370
371
|
|
|
372
|
+
extension DispatchQueue {
|
|
373
|
+
/// A serial dispatch queue ensures that IO related to loading dot Lottie files don't overlap,
|
|
374
|
+
/// which can trigger file loading errors due to concurrent unzipping on a single archive.
|
|
375
|
+
public static let dotLottie = DispatchQueue(
|
|
376
|
+
label: "com.airbnb.lottie.dot-lottie",
|
|
377
|
+
qos: .userInitiated)
|
|
371
378
|
}
|
|
@@ -39,7 +39,11 @@ open class LottieAnimationViewBase: UIView {
|
|
|
39
39
|
|
|
40
40
|
var screenScale: CGFloat {
|
|
41
41
|
#if os(iOS) || os(tvOS)
|
|
42
|
-
|
|
42
|
+
if #available(iOS 13.0, tvOS 13.0, *) {
|
|
43
|
+
return max(UITraitCollection.current.displayScale, 1)
|
|
44
|
+
} else {
|
|
45
|
+
return UIScreen.main.scale
|
|
46
|
+
}
|
|
43
47
|
#else // if os(visionOS)
|
|
44
48
|
// We intentionally don't check `#if os(visionOS)`, because that emits
|
|
45
49
|
// a warning when building on Xcode 14 and earlier.
|
|
@@ -79,6 +83,5 @@ open class LottieAnimationViewBase: UIView {
|
|
|
79
83
|
func animationWillEnterForeground() {
|
|
80
84
|
// Implemented by subclasses.
|
|
81
85
|
}
|
|
82
|
-
|
|
83
86
|
}
|
|
84
87
|
#endif
|
package/lottie-ios.podspec
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
Pod::Spec.new do |s|
|
|
10
10
|
s.name = 'lottie-ios'
|
|
11
|
-
s.version = '4.3.
|
|
11
|
+
s.version = '4.3.4'
|
|
12
12
|
s.summary = 'A library to render native animations from bodymovin json'
|
|
13
13
|
|
|
14
14
|
s.description = <<-DESC
|
|
@@ -36,5 +36,6 @@ Lottie enables designers to create and ship beautiful animations without an engi
|
|
|
36
36
|
s.ios.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore']
|
|
37
37
|
s.tvos.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore']
|
|
38
38
|
s.osx.frameworks = ['AppKit', 'CoreGraphics', 'QuartzCore']
|
|
39
|
+
s.weak_frameworks = ['SwiftUI', 'Combine']
|
|
39
40
|
s.module_name = 'Lottie'
|
|
40
41
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lottie-ios",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.4",
|
|
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": {
|