lottie-ios 4.3.4 → 4.4.0
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/.github/workflows/main.yml +51 -58
- package/Lottie.xcodeproj/project.pbxproj +20 -0
- package/Lottie.xcodeproj/xcuserdata/calstephens.xcuserdatad/xcschemes/xcschememanagement.plist +4 -17
- package/Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved +37 -40
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +9 -680
- package/Package.resolved +20 -22
- package/Package.swift +3 -2
- package/README.md +21 -3
- package/Rakefile +52 -28
- package/Sources/PrivacyInfo.xcprivacy +23 -0
- package/Sources/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +1 -1
- package/Sources/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +23 -13
- package/Sources/Private/CoreAnimation/Animations/CustomPathAnimation.swift +8 -2
- package/Sources/Private/CoreAnimation/Animations/EllipseAnimation.swift +7 -1
- package/Sources/Private/CoreAnimation/Animations/GradientAnimations.swift +15 -2
- package/Sources/Private/CoreAnimation/Animations/LayerProperty.swift +8 -1
- package/Sources/Private/CoreAnimation/Animations/RectangleAnimation.swift +8 -1
- package/Sources/Private/CoreAnimation/Animations/StarAnimation.swift +12 -1
- package/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift +0 -1
- package/Sources/Private/CoreAnimation/Animations/TransformAnimations.swift +19 -11
- package/Sources/Private/CoreAnimation/Animations/VisibilityAnimation.swift +45 -19
- package/Sources/Private/CoreAnimation/CoreAnimationLayer.swift +38 -3
- package/Sources/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +1 -1
- package/Sources/Private/CoreAnimation/Extensions/Keyframes+combined.swift +9 -2
- package/Sources/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
- package/Sources/Private/CoreAnimation/Layers/AnimationLayer.swift +77 -13
- package/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +1 -1
- package/Sources/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +2 -2
- package/Sources/Private/CoreAnimation/Layers/ImageLayer.swift +1 -1
- package/Sources/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +1 -7
- package/Sources/Private/CoreAnimation/Layers/PreCompLayer.swift +19 -53
- package/Sources/Private/CoreAnimation/Layers/ShapeItemLayer.swift +2 -2
- package/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift +2 -4
- package/Sources/Private/CoreAnimation/Layers/SolidLayer.swift +5 -2
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +1 -1
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +10 -10
- package/Sources/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +3 -3
- package/Sources/Private/EmbeddedLibraries/README.md +2 -0
- package/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +2 -2
- package/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +7 -7
- package/Sources/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +2 -2
- package/Sources/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +5 -5
- package/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +1 -2
- package/Sources/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +1 -3
- package/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +1 -2
- package/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +2 -3
- package/Sources/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +2 -3
- package/Sources/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +5 -12
- package/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +0 -1
- package/Sources/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +0 -2
- package/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +3 -3
- package/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +12 -12
- package/Sources/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +1 -2
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +0 -2
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +1 -3
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +0 -2
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +1 -3
- package/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +1 -3
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +1 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +2 -3
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +1 -3
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +2 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +0 -1
- package/Sources/Private/Model/Assets/Asset.swift +2 -3
- package/Sources/Private/Model/Assets/AssetLibrary.swift +11 -11
- package/Sources/Private/Model/Assets/ImageAsset.swift +20 -0
- package/Sources/Private/Model/Assets/PrecompAsset.swift +0 -2
- package/Sources/Private/Model/DictionaryInitializable.swift +18 -10
- package/Sources/Private/Model/DotLottie/DotLottieImageProvider.swift +9 -6
- package/Sources/Private/Model/DotLottie/DotLottieUtils.swift +1 -1
- package/Sources/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +0 -2
- package/Sources/Private/Model/Keyframes/KeyframeData.swift +1 -4
- package/Sources/Private/Model/Keyframes/KeyframeGroup.swift +1 -3
- package/Sources/Private/Model/LayerEffects/DropShadowEffect.swift +0 -2
- package/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +0 -2
- package/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift +2 -3
- package/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +0 -2
- package/Sources/Private/Model/LayerEffects/LayerEffect.swift +2 -3
- package/Sources/Private/Model/LayerStyles/DropShadowStyle.swift +0 -2
- package/Sources/Private/Model/LayerStyles/LayerStyle.swift +2 -3
- package/Sources/Private/Model/Layers/ImageLayerModel.swift +0 -2
- package/Sources/Private/Model/Layers/LayerModel.swift +11 -5
- package/Sources/Private/Model/Layers/PreCompLayerModel.swift +0 -2
- package/Sources/Private/Model/Layers/ShapeLayerModel.swift +0 -2
- package/Sources/Private/Model/Layers/SolidLayerModel.swift +0 -2
- package/Sources/Private/Model/Layers/TextLayerModel.swift +0 -2
- package/Sources/Private/Model/Objects/DashPattern.swift +1 -3
- package/Sources/Private/Model/Objects/Marker.swift +0 -2
- package/Sources/Private/Model/Objects/Mask.swift +0 -2
- package/Sources/Private/Model/Objects/Transform.swift +46 -9
- package/Sources/Private/Model/ShapeItems/Ellipse.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Fill.swift +0 -2
- package/Sources/Private/Model/ShapeItems/GradientFill.swift +1 -3
- package/Sources/Private/Model/ShapeItems/GradientStroke.swift +1 -3
- package/Sources/Private/Model/ShapeItems/Group.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Merge.swift +1 -3
- package/Sources/Private/Model/ShapeItems/Rectangle.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Repeater.swift +0 -2
- package/Sources/Private/Model/ShapeItems/RoundedCorners.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Shape.swift +0 -2
- package/Sources/Private/Model/ShapeItems/ShapeItem.swift +2 -3
- package/Sources/Private/Model/ShapeItems/ShapeTransform.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Star.swift +1 -3
- package/Sources/Private/Model/ShapeItems/Stroke.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Trim.swift +1 -3
- package/Sources/Private/Model/Text/Font.swift +0 -2
- package/Sources/Private/Model/Text/Glyph.swift +0 -2
- package/Sources/Private/Model/Text/TextAnimator.swift +0 -2
- package/Sources/Private/Model/Text/TextDocument.swift +2 -4
- package/Sources/Private/Utility/Debugging/AnimatorNodeDebugging.swift +0 -2
- package/Sources/Private/Utility/Debugging/LayerDebugging.swift +4 -5
- package/Sources/Private/Utility/Extensions/AnimationKeypathExtension.swift +2 -3
- package/Sources/Private/Utility/Extensions/DataExtension.swift +0 -1
- package/Sources/Private/Utility/Extensions/StringExtensions.swift +5 -0
- package/Sources/Private/Utility/Helpers/AnimationContext.swift +2 -3
- package/Sources/Private/Utility/Helpers/AnyEquatable.swift +0 -2
- package/Sources/Private/Utility/LottieAnimationSource.swift +11 -1
- package/Sources/Private/Utility/Primitives/BezierPath.swift +2 -3
- package/Sources/Private/Utility/Primitives/CGPointExtension.swift +1 -1
- package/Sources/Private/Utility/Primitives/ColorExtension.swift +1 -2
- package/Sources/Private/Utility/Primitives/VectorsExtensions.swift +6 -6
- package/Sources/Public/Animation/LottieAnimation.swift +2 -2
- package/Sources/Public/Animation/LottieAnimationHelpers.swift +7 -5
- package/Sources/Public/Animation/LottieAnimationLayer.swift +29 -43
- package/Sources/Public/Animation/LottieAnimationView.swift +6 -7
- package/Sources/Public/Animation/LottieAnimationViewInitializers.swift +3 -3
- package/Sources/Public/Animation/LottiePlaybackMode.swift +53 -0
- package/Sources/Public/Animation/LottieView.swift +143 -48
- package/Sources/Public/AnimationCache/AnimationCacheProvider.swift +0 -2
- package/Sources/Public/AnimationCache/DefaultAnimationCache.swift +11 -1
- package/Sources/Public/AnimationCache/LRUAnimationCache.swift +0 -2
- package/Sources/Public/Controls/AnimatedButton.swift +4 -6
- package/Sources/Public/Controls/AnimatedControl.swift +1 -3
- package/Sources/Public/Controls/AnimatedSwitch.swift +1 -3
- package/Sources/Public/DotLottie/Cache/DotLottieCache.swift +9 -0
- package/Sources/Public/DotLottie/Cache/DotLottieCacheProvider.swift +1 -3
- package/Sources/Public/DotLottie/DotLottieConfiguration.swift +53 -5
- package/Sources/Public/DotLottie/DotLottieFile.swift +4 -3
- package/Sources/Public/DotLottie/DotLottieFileHelpers.swift +6 -6
- package/Sources/Public/DynamicProperties/AnimationKeypath.swift +0 -2
- package/Sources/Public/DynamicProperties/AnyValueProvider.swift +0 -1
- package/Sources/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +2 -2
- package/Sources/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +1 -1
- package/Sources/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +1 -1
- package/Sources/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +1 -1
- package/Sources/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +1 -1
- package/Sources/Public/FontProvider/AnimationFontProvider.swift +0 -2
- package/Sources/Public/ImageProvider/AnimationImageProvider.swift +0 -2
- package/Sources/Public/Keyframes/Interpolatable.swift +26 -0
- package/Sources/Public/Primitives/LottieColor.swift +0 -2
- package/Sources/Public/Primitives/Vectors.swift +0 -2
- package/Sources/Public/TextProvider/AnimationTextProvider.swift +0 -2
- package/Sources/Public/iOS/AnimationSubview.swift +0 -1
- package/Sources/Public/iOS/BundleImageProvider.swift +3 -8
- package/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift +4 -8
- package/Sources/Public/iOS/UIColorExtension.swift +1 -2
- package/Sources/Public/macOS/BundleImageProvider.macOS.swift +3 -6
- package/lottie-ios.podspec +5 -2
- package/package.json +1 -1
- package/Lottie.xcodeproj/project.xcworkspace/xcuserdata/cal.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcodeproj/project.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcodeproj/xcuserdata/cal.xcuserdatad/xcschemes/xcschememanagement.plist +0 -37
- package/Lottie.xcworkspace/xcuserdata/cal.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcworkspace/xcuserdata/cal.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
- package/Lottie.xcworkspace/xcuserdata/cal.xcuserdatad/xcdebugger/Expressions.xcexplist +0 -153
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/IDEFindNavigatorScopes.plist +0 -5
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Expressions.xcexplist +0 -231
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcschemes/xcschememanagement.plist +0 -37
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
import Foundation
|
|
35
35
|
|
|
36
|
-
#if
|
|
36
|
+
#if canImport(UIKit)
|
|
37
37
|
import UIKit
|
|
38
38
|
|
|
39
39
|
/// Notification that cache should be cleared
|
|
@@ -74,7 +74,7 @@ final class LRUCache<Key: Hashable, Value> {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
deinit {
|
|
77
|
-
if let token
|
|
77
|
+
if let token {
|
|
78
78
|
notificationCenter.removeObserver(token)
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -131,7 +131,7 @@ extension LRUCache {
|
|
|
131
131
|
|
|
132
132
|
/// Insert a value into the cache with optional `cost`
|
|
133
133
|
func setValue(_ value: Value?, forKey key: Key, cost: Int = 0) {
|
|
134
|
-
guard let value
|
|
134
|
+
guard let value else {
|
|
135
135
|
removeValue(forKey: key)
|
|
136
136
|
return
|
|
137
137
|
}
|
|
@@ -39,3 +39,5 @@ When doing this, follow these steps:
|
|
|
39
39
|
|
|
40
40
|
5. Change all of the `public` symbols defined in the module to instead be `internal`
|
|
41
41
|
to prevent Lottie from exposing any APIs from other libraries.
|
|
42
|
+
|
|
43
|
+
6. If the dependency provides a privacy manifest, incorporate content from that dependency's privacy manifest into Lottie's privacy manifest.
|
|
@@ -92,13 +92,13 @@ extension Archive {
|
|
|
92
92
|
}
|
|
93
93
|
case .directory:
|
|
94
94
|
_ = try provider(0, 0)
|
|
95
|
-
if let progress
|
|
95
|
+
if let progress { progress.completedUnitCount = progress.totalUnitCount }
|
|
96
96
|
case .symlink:
|
|
97
97
|
let (linkSizeWritten, linkChecksum) = try writeSymbolicLink(
|
|
98
98
|
size: Int(uncompressedSize),
|
|
99
99
|
provider: provider)
|
|
100
100
|
(sizeWritten, checksum) = (Int64(linkSizeWritten), linkChecksum)
|
|
101
|
-
if let progress
|
|
101
|
+
if let progress { progress.completedUnitCount = progress.totalUnitCount }
|
|
102
102
|
}
|
|
103
103
|
return (sizeWritten, checksum)
|
|
104
104
|
}
|
|
@@ -102,7 +102,7 @@ private func fileFromCookie(cookie: UnsafeRawPointer) -> MemoryFile {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
private func closeStub(_ cookie: UnsafeMutableRawPointer?) -> Int32 {
|
|
105
|
-
if let cookie
|
|
105
|
+
if let cookie {
|
|
106
106
|
Unmanaged<MemoryFile>.fromOpaque(cookie).release()
|
|
107
107
|
}
|
|
108
108
|
return 0
|
|
@@ -115,7 +115,7 @@ private func readStub(
|
|
|
115
115
|
_ count: Int32)
|
|
116
116
|
-> Int32
|
|
117
117
|
{
|
|
118
|
-
guard let cookie
|
|
118
|
+
guard let cookie, let bytePtr else { return 0 }
|
|
119
119
|
return Int32(fileFromCookie(cookie: cookie).readData(
|
|
120
120
|
buffer: UnsafeMutableRawBufferPointer(start: bytePtr, count: Int(count))))
|
|
121
121
|
}
|
|
@@ -126,7 +126,7 @@ private func writeStub(
|
|
|
126
126
|
_ count: Int32)
|
|
127
127
|
-> Int32
|
|
128
128
|
{
|
|
129
|
-
guard let cookie
|
|
129
|
+
guard let cookie, let bytePtr else { return 0 }
|
|
130
130
|
return Int32(fileFromCookie(cookie: cookie).writeData(
|
|
131
131
|
buffer: UnsafeRawBufferPointer(start: bytePtr, count: Int(count))))
|
|
132
132
|
}
|
|
@@ -137,7 +137,7 @@ private func seekStub(
|
|
|
137
137
|
_ whence: Int32)
|
|
138
138
|
-> fpos_t
|
|
139
139
|
{
|
|
140
|
-
guard let cookie
|
|
140
|
+
guard let cookie else { return 0 }
|
|
141
141
|
return fpos_t(fileFromCookie(cookie: cookie).seek(offset: Int(offset), whence: whence))
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -148,7 +148,7 @@ private func readStub(
|
|
|
148
148
|
_ count: Int)
|
|
149
149
|
-> Int
|
|
150
150
|
{
|
|
151
|
-
guard let cookie
|
|
151
|
+
guard let cookie, let bytePtr else { return 0 }
|
|
152
152
|
return fileFromCookie(cookie: cookie).readData(
|
|
153
153
|
buffer: UnsafeMutableRawBufferPointer(start: bytePtr, count: count))
|
|
154
154
|
}
|
|
@@ -159,7 +159,7 @@ private func writeStub(
|
|
|
159
159
|
_ count: Int)
|
|
160
160
|
-> Int
|
|
161
161
|
{
|
|
162
|
-
guard let cookie
|
|
162
|
+
guard let cookie, let bytePtr else { return 0 }
|
|
163
163
|
return fileFromCookie(cookie: cookie).writeData(
|
|
164
164
|
buffer: UnsafeRawBufferPointer(start: bytePtr, count: count))
|
|
165
165
|
}
|
|
@@ -170,7 +170,7 @@ private func seekStub(
|
|
|
170
170
|
_ whence: Int32)
|
|
171
171
|
-> Int32
|
|
172
172
|
{
|
|
173
|
-
guard let cookie
|
|
173
|
+
guard let cookie, let offset else { return 0 }
|
|
174
174
|
let result = fileFromCookie(cookie: cookie).seek(offset: Int(offset.pointee), whence: whence)
|
|
175
175
|
if result >= 0 {
|
|
176
176
|
offset.pointee = result
|
|
@@ -149,7 +149,7 @@ extension Data {
|
|
|
149
149
|
position += Int64(stream.prepare(for: sourceData))
|
|
150
150
|
} catch { throw error }
|
|
151
151
|
}
|
|
152
|
-
if let sourceData
|
|
152
|
+
if let sourceData {
|
|
153
153
|
sourceData.withUnsafeBytes { rawBufferPointer in
|
|
154
154
|
if let baseAddress = rawBufferPointer.baseAddress {
|
|
155
155
|
let pointer = baseAddress.assumingMemoryBound(to: UInt8.self)
|
|
@@ -179,7 +179,7 @@ extension Data {
|
|
|
179
179
|
extension compression_stream {
|
|
180
180
|
|
|
181
181
|
fileprivate mutating func prepare(for sourceData: Data?) -> Int {
|
|
182
|
-
guard let sourceData
|
|
182
|
+
guard let sourceData else { return 0 }
|
|
183
183
|
|
|
184
184
|
src_size = sourceData.count
|
|
185
185
|
return sourceData.count
|
|
@@ -156,7 +156,7 @@ extension FileManager {
|
|
|
156
156
|
if isDirectory {
|
|
157
157
|
let subPaths = try subpathsOfDirectory(atPath: sourceURL.path)
|
|
158
158
|
var totalUnitCount = Int64(0)
|
|
159
|
-
if let progress
|
|
159
|
+
if let progress {
|
|
160
160
|
totalUnitCount = subPaths.reduce(Int64(0)) {
|
|
161
161
|
let itemURL = sourceURL.appendingPathComponent($1)
|
|
162
162
|
let itemSize = archive.totalUnitCountForAddingItem(at: itemURL)
|
|
@@ -171,7 +171,7 @@ extension FileManager {
|
|
|
171
171
|
for entryPath in subPaths {
|
|
172
172
|
let finalEntryPath = shouldKeepParent ? directoryPrefix + "/" + entryPath : entryPath
|
|
173
173
|
let finalBaseURL = shouldKeepParent ? sourceURL.deletingLastPathComponent() : sourceURL
|
|
174
|
-
if let progress
|
|
174
|
+
if let progress {
|
|
175
175
|
let itemURL = sourceURL.appendingPathComponent(entryPath)
|
|
176
176
|
let entryProgress = archive.makeProgressForAddingItem(at: itemURL)
|
|
177
177
|
progress.addChild(entryProgress, withPendingUnitCount: entryProgress.totalUnitCount)
|
|
@@ -233,7 +233,7 @@ extension FileManager {
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
var totalUnitCount = Int64(0)
|
|
236
|
-
if let progress
|
|
236
|
+
if let progress {
|
|
237
237
|
totalUnitCount = sortedEntries.reduce(0) { $0 + archive.totalUnitCountForReading($1) }
|
|
238
238
|
progress.totalUnitCount = totalUnitCount
|
|
239
239
|
}
|
|
@@ -247,7 +247,7 @@ extension FileManager {
|
|
|
247
247
|
userInfo: [NSFilePathErrorKey: entryURL.path])
|
|
248
248
|
}
|
|
249
249
|
let crc32: CRC32
|
|
250
|
-
if let progress
|
|
250
|
+
if let progress {
|
|
251
251
|
let entryProgress = archive.makeProgressForReading(entry)
|
|
252
252
|
progress.addChild(entryProgress, withPendingUnitCount: entryProgress.totalUnitCount)
|
|
253
253
|
crc32 = try archive.extract(entry, to: entryURL, skipCRC32: skipCRC32, progress: entryProgress)
|
|
@@ -349,7 +349,7 @@ extension Date {
|
|
|
349
349
|
extension CocoaError {
|
|
350
350
|
static func error(_ code: CocoaError.Code, userInfo: [AnyHashable: Any]? = nil, url: URL? = nil) -> Error {
|
|
351
351
|
var info: [String: Any] = userInfo as? [String: Any] ?? [:]
|
|
352
|
-
if let url
|
|
352
|
+
if let url {
|
|
353
353
|
info[NSURLErrorKey] = url
|
|
354
354
|
}
|
|
355
355
|
return NSError(domain: NSCocoaErrorDomain, code: code.rawValue, userInfo: info)
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/22/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import QuartzCore
|
|
10
9
|
|
|
11
10
|
// MARK: - CompositionLayer
|
|
@@ -52,7 +51,7 @@ class CompositionLayer: CALayer, KeypathSearchable {
|
|
|
52
51
|
compositingFilter = layer.blendMode.filterName
|
|
53
52
|
addSublayer(contentsLayer)
|
|
54
53
|
|
|
55
|
-
if let maskLayer
|
|
54
|
+
if let maskLayer {
|
|
56
55
|
contentsLayer.mask = maskLayer
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/25/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import CoreGraphics
|
|
9
|
-
import Foundation
|
|
10
8
|
import QuartzCore
|
|
11
9
|
|
|
12
10
|
final class ImageCompositionLayer: CompositionLayer {
|
|
@@ -40,7 +38,7 @@ final class ImageCompositionLayer: CompositionLayer {
|
|
|
40
38
|
|
|
41
39
|
var image: CGImage? = nil {
|
|
42
40
|
didSet {
|
|
43
|
-
if let image
|
|
41
|
+
if let image {
|
|
44
42
|
contentsLayer.contents = image
|
|
45
43
|
} else {
|
|
46
44
|
contentsLayer.contents = nil
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/25/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import QuartzCore
|
|
10
9
|
|
|
11
10
|
extension MaskMode {
|
|
@@ -129,7 +128,7 @@ private class MaskLayer: CALayer {
|
|
|
129
128
|
let maskLayer = CAShapeLayer()
|
|
130
129
|
|
|
131
130
|
func updateWithFrame(frame: CGFloat, forceUpdates: Bool) {
|
|
132
|
-
guard let properties
|
|
131
|
+
guard let properties else { return }
|
|
133
132
|
if properties.opacity.needsUpdate(frame: frame) || forceUpdates {
|
|
134
133
|
properties.opacity.update(frame: frame)
|
|
135
134
|
opacity = Float(properties.opacity.value.cgFloatValue)
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/25/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import QuartzCore
|
|
10
9
|
|
|
11
10
|
final class PreCompositionLayer: CompositionLayer {
|
|
@@ -102,7 +101,7 @@ final class PreCompositionLayer: CompositionLayer {
|
|
|
102
101
|
let remappingNode: NodeProperty<LottieVector1D>?
|
|
103
102
|
|
|
104
103
|
override var keypathProperties: [String: AnyNodeProperty] {
|
|
105
|
-
guard let remappingNode
|
|
104
|
+
guard let remappingNode else {
|
|
106
105
|
return super.keypathProperties
|
|
107
106
|
}
|
|
108
107
|
return ["Time Remap" : remappingNode]
|
|
@@ -110,7 +109,7 @@ final class PreCompositionLayer: CompositionLayer {
|
|
|
110
109
|
|
|
111
110
|
override func displayContentsWithFrame(frame: CGFloat, forceUpdates: Bool) {
|
|
112
111
|
let localFrame: CGFloat
|
|
113
|
-
if let remappingNode
|
|
112
|
+
if let remappingNode {
|
|
114
113
|
remappingNode.update(frame: frame)
|
|
115
114
|
localFrame = remappingNode.value.cgFloatValue * frameRate
|
|
116
115
|
} else {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/25/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import QuartzCore
|
|
10
9
|
|
|
11
10
|
final class SolidCompositionLayer: CompositionLayer {
|
|
@@ -45,12 +44,12 @@ final class SolidCompositionLayer: CompositionLayer {
|
|
|
45
44
|
let solidShape = CAShapeLayer()
|
|
46
45
|
|
|
47
46
|
override var keypathProperties: [String: AnyNodeProperty] {
|
|
48
|
-
guard let colorProperty
|
|
47
|
+
guard let colorProperty else { return super.keypathProperties }
|
|
49
48
|
return [PropertyName.color.rawValue : colorProperty]
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
override func displayContentsWithFrame(frame: CGFloat, forceUpdates _: Bool) {
|
|
53
|
-
guard let colorProperty
|
|
52
|
+
guard let colorProperty else { return }
|
|
54
53
|
colorProperty.update(frame: frame)
|
|
55
54
|
solidShape.fillColor = colorProperty.value.cgColorValue
|
|
56
55
|
}
|
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/25/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import CoreGraphics
|
|
9
|
-
import CoreText
|
|
10
|
-
import Foundation
|
|
11
|
-
import QuartzCore
|
|
12
|
-
|
|
13
8
|
/// Needed for NSMutableParagraphStyle...
|
|
14
9
|
#if os(OSX)
|
|
15
10
|
import AppKit
|
|
@@ -69,7 +64,7 @@ final class TextCompositionLayer: CompositionLayer {
|
|
|
69
64
|
self.textLayer.masksToBounds = false
|
|
70
65
|
self.textLayer.isGeometryFlipped = true
|
|
71
66
|
|
|
72
|
-
if let rootNode
|
|
67
|
+
if let rootNode {
|
|
73
68
|
childKeypaths.append(rootNode)
|
|
74
69
|
}
|
|
75
70
|
}
|
|
@@ -102,17 +97,15 @@ final class TextCompositionLayer: CompositionLayer {
|
|
|
102
97
|
var fontProvider: AnimationFontProvider
|
|
103
98
|
weak var rootAnimationLayer: MainThreadAnimationLayer?
|
|
104
99
|
|
|
105
|
-
lazy var fullAnimationKeypath: AnimationKeypath =
|
|
106
|
-
// Individual layers don't know their full keypaths, so we have to delegate
|
|
100
|
+
lazy var fullAnimationKeypath: AnimationKeypath = // Individual layers don't know their full keypaths, so we have to delegate
|
|
107
101
|
// to the `MainThreadAnimationLayer` to search the layer hierarchy and find
|
|
108
102
|
// the full keypath (which includes this layer's parent layers)
|
|
109
103
|
rootAnimationLayer?.keypath(for: self)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}()
|
|
104
|
+
// If that failed for some reason, just use the last path component (which we do have here)
|
|
105
|
+
?? AnimationKeypath(keypath: keypathName)
|
|
113
106
|
|
|
114
107
|
override func displayContentsWithFrame(frame: CGFloat, forceUpdates: Bool) {
|
|
115
|
-
guard let textDocument
|
|
108
|
+
guard let textDocument else { return }
|
|
116
109
|
|
|
117
110
|
textLayer.contentsScale = renderScale
|
|
118
111
|
|
package/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import CoreGraphics
|
|
9
9
|
import Foundation
|
|
10
10
|
|
|
11
|
-
extension
|
|
11
|
+
extension [LayerModel] {
|
|
12
12
|
|
|
13
13
|
func initializeCompositionLayers(
|
|
14
14
|
assetLibrary: AssetLibrary?,
|
|
@@ -41,7 +41,7 @@ extension Array where Element == LayerModel {
|
|
|
41
41
|
layerMap[layer.index] = solidContainer
|
|
42
42
|
} else if
|
|
43
43
|
let precompLayer = layer as? PreCompLayerModel,
|
|
44
|
-
let assetLibrary
|
|
44
|
+
let assetLibrary,
|
|
45
45
|
let precompAsset = assetLibrary.precompAssets[precompLayer.referenceID]
|
|
46
46
|
{
|
|
47
47
|
let precompContainer = PreCompositionLayer(
|
|
@@ -58,7 +58,7 @@ extension Array where Element == LayerModel {
|
|
|
58
58
|
layerMap[layer.index] = precompContainer
|
|
59
59
|
} else if
|
|
60
60
|
let imageLayer = layer as? ImageLayerModel,
|
|
61
|
-
let assetLibrary
|
|
61
|
+
let assetLibrary,
|
|
62
62
|
let imageAsset = assetLibrary.imageAssets[imageLayer.referenceID]
|
|
63
63
|
{
|
|
64
64
|
let imageContainer = ImageCompositionLayer(
|
|
@@ -117,7 +117,7 @@ final class CoreTextRenderLayer: CALayer {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
override func draw(in ctx: CGContext) {
|
|
120
|
-
guard let attributedString
|
|
120
|
+
guard let attributedString else { return }
|
|
121
121
|
updateTextContent()
|
|
122
122
|
guard fillFrameSetter != nil || strokeFrameSetter != nil else { return }
|
|
123
123
|
|
|
@@ -155,21 +155,21 @@ final class CoreTextRenderLayer: CALayer {
|
|
|
155
155
|
// For some reason some fonts, such as Helvetica draw with and ascender that is greater than the one reported by CTFontGetAscender.
|
|
156
156
|
// I suspect this is actually an issue with the Attributed string, but cannot reproduce.
|
|
157
157
|
|
|
158
|
-
if let fillFrame
|
|
158
|
+
if let fillFrame {
|
|
159
159
|
ctx.adjustWithLineOrigins(in: fillFrame, with: font)
|
|
160
|
-
} else if let strokeFrame
|
|
160
|
+
} else if let strokeFrame {
|
|
161
161
|
ctx.adjustWithLineOrigins(in: strokeFrame, with: font)
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
if !strokeOnTop, let strokeFrame
|
|
164
|
+
if !strokeOnTop, let strokeFrame {
|
|
165
165
|
CTFrameDraw(strokeFrame, ctx)
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
if let fillFrame
|
|
168
|
+
if let fillFrame {
|
|
169
169
|
CTFrameDraw(fillFrame, ctx)
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
if strokeOnTop, let strokeFrame
|
|
172
|
+
if strokeOnTop, let strokeFrame {
|
|
173
173
|
CTFrameDraw(strokeFrame, ctx)
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -186,7 +186,7 @@ final class CoreTextRenderLayer: CALayer {
|
|
|
186
186
|
// Draws Debug colors for the font alignment.
|
|
187
187
|
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
|
|
188
188
|
private func drawDebug(_ ctx: CGContext) {
|
|
189
|
-
if let font
|
|
189
|
+
if let font {
|
|
190
190
|
let ascent = CTFontGetAscent(font)
|
|
191
191
|
let descent = CTFontGetDescent(font)
|
|
192
192
|
let capHeight = CTFontGetCapHeight(font)
|
|
@@ -224,7 +224,7 @@ final class CoreTextRenderLayer: CALayer {
|
|
|
224
224
|
private func updateTextContent() {
|
|
225
225
|
guard needsContentUpdate else { return }
|
|
226
226
|
needsContentUpdate = false
|
|
227
|
-
guard let font
|
|
227
|
+
guard let font, let text, text.count > 0, fillColor != nil || strokeColor != nil else {
|
|
228
228
|
drawingRect = .zero
|
|
229
229
|
drawingAnchor = .zero
|
|
230
230
|
attributedString = nil
|
|
@@ -256,7 +256,7 @@ final class CoreTextRenderLayer: CALayer {
|
|
|
256
256
|
NSAttributedString.Key.paragraphStyle: paragraphStyle,
|
|
257
257
|
]
|
|
258
258
|
|
|
259
|
-
if let fillColor
|
|
259
|
+
if let fillColor {
|
|
260
260
|
attributes[NSAttributedString.Key.foregroundColor] = fillColor
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -270,7 +270,7 @@ final class CoreTextRenderLayer: CALayer {
|
|
|
270
270
|
fillFrameSetter = nil
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
if let strokeColor
|
|
273
|
+
if let strokeColor {
|
|
274
274
|
attributes[NSAttributedString.Key.foregroundColor] = nil
|
|
275
275
|
attributes[NSAttributedString.Key.strokeWidth] = strokeWidth
|
|
276
276
|
attributes[NSAttributedString.Key.strokeColor] = strokeColor
|
|
@@ -287,7 +287,7 @@ final class CoreTextRenderLayer: CALayer {
|
|
|
287
287
|
|
|
288
288
|
// Calculate drawing size and anchor offset
|
|
289
289
|
let textAnchor: CGPoint
|
|
290
|
-
if let preferredSize
|
|
290
|
+
if let preferredSize {
|
|
291
291
|
drawingRect = CGRect(origin: .zero, size: preferredSize)
|
|
292
292
|
drawingRect.size.height += (ascent - capHeight)
|
|
293
293
|
drawingRect.size.height += descent
|
|
@@ -332,7 +332,7 @@ final class CoreTextRenderLayer: CALayer {
|
|
|
332
332
|
extension CGContext {
|
|
333
333
|
|
|
334
334
|
fileprivate func adjustWithLineOrigins(in frame: CTFrame, with font: CTFont?) {
|
|
335
|
-
guard let font
|
|
335
|
+
guard let font else { return }
|
|
336
336
|
|
|
337
337
|
let count = CFArrayGetCount(CTFrameGetLines(frame))
|
|
338
338
|
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/28/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import QuartzCore
|
|
10
9
|
|
|
11
10
|
/// A layer that inverses the alpha output of its input layer.
|
|
@@ -46,7 +45,7 @@ final class InvertedMatteLayer: CALayer, CompositionLayerDelegate {
|
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
override func draw(in ctx: CGContext) {
|
|
49
|
-
guard let inputMatte
|
|
48
|
+
guard let inputMatte else { return }
|
|
50
49
|
ctx.setFillColor(.rgb(0, 0, 0))
|
|
51
50
|
ctx.fill(bounds)
|
|
52
51
|
ctx.setBlendMode(.destinationOut)
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/25/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
/// Connects a LottieImageProvider to a group of image layers
|
|
11
9
|
final class LayerImageProvider {
|
|
12
10
|
|
|
@@ -15,7 +13,7 @@ final class LayerImageProvider {
|
|
|
15
13
|
init(imageProvider: AnimationImageProvider, assets: [String: ImageAsset]?) {
|
|
16
14
|
self.imageProvider = imageProvider
|
|
17
15
|
imageLayers = [ImageCompositionLayer]()
|
|
18
|
-
if let assets
|
|
16
|
+
if let assets {
|
|
19
17
|
imageAssets = assets
|
|
20
18
|
} else {
|
|
21
19
|
imageAssets = [:]
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/18/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
// MARK: - NodeTree
|
|
11
9
|
|
|
12
10
|
final class NodeTree {
|
|
@@ -17,7 +15,7 @@ final class NodeTree {
|
|
|
17
15
|
var childrenNodes: [AnimatorNode] = []
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
extension
|
|
18
|
+
extension [ShapeItem] {
|
|
21
19
|
func initializeNodeTree() -> NodeTree {
|
|
22
20
|
let nodeTree = NodeTree()
|
|
23
21
|
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/30/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import CoreGraphics
|
|
9
|
-
import Foundation
|
|
10
8
|
import QuartzCore
|
|
11
9
|
|
|
12
10
|
class GroupOutputNode: NodeOutput {
|
|
@@ -59,7 +57,7 @@ class GroupOutputNode: NodeOutput {
|
|
|
59
57
|
}
|
|
60
58
|
var xform = CATransform3DGetAffineTransform(transform)
|
|
61
59
|
if
|
|
62
|
-
let rootNode
|
|
60
|
+
let rootNode,
|
|
63
61
|
let rootPath = rootNode.outputPath,
|
|
64
62
|
let xformedPath = rootPath.copy(using: &xform)
|
|
65
63
|
{
|
package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import CoreGraphics
|
|
9
|
-
import Foundation
|
|
10
9
|
|
|
11
10
|
class PassThroughOutputNode: NodeOutput {
|
|
12
11
|
|
|
@@ -24,7 +23,7 @@ class PassThroughOutputNode: NodeOutput {
|
|
|
24
23
|
var isEnabled = true
|
|
25
24
|
|
|
26
25
|
var outputPath: CGPath? {
|
|
27
|
-
if let parent
|
|
26
|
+
if let parent {
|
|
28
27
|
return parent.outputPath
|
|
29
28
|
}
|
|
30
29
|
return nil
|