lottie-ios 4.0.1 → 4.1.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.
Files changed (43) hide show
  1. package/.github/workflows/main.yml +19 -0
  2. package/Lottie.xcodeproj/project.pbxproj +4 -0
  3. package/Lottie.xcodeproj/xcuserdata/calstephens.xcuserdatad/xcschemes/xcschememanagement.plist +3 -3
  4. package/Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved +2 -2
  5. package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  6. package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +58 -3
  7. package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Expressions.xcexplist +104 -33
  8. package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcschemes/xcschememanagement.plist +7 -0
  9. package/LottieAnimation/LottieAnimation.xcodeproj/project.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  10. package/LottieAnimation/LottieAnimation.xcodeproj/project.xcworkspace/xcuserdata/valentinperignon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  11. package/LottieAnimation/LottieAnimation.xcodeproj/xcuserdata/calstephens.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  12. package/LottieAnimation/LottieAnimation.xcodeproj/xcuserdata/valentinperignon.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
  13. package/LottieAnimation/LottieAnimation.xcodeproj/xcuserdata/valentinperignon.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  14. package/Package.resolved +25 -0
  15. package/Package.swift +5 -0
  16. package/README.md +14 -3
  17. package/Rakefile +27 -42
  18. package/Sources/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +10 -8
  19. package/Sources/Private/CoreAnimation/Animations/GradientAnimations.swift +2 -1
  20. package/Sources/Private/CoreAnimation/Animations/LayerProperty.swift +26 -3
  21. package/Sources/Private/CoreAnimation/Animations/ShapeAnimation.swift +2 -1
  22. package/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift +14 -1
  23. package/Sources/Private/CoreAnimation/Animations/TransformAnimations.swift +81 -6
  24. package/Sources/Private/CoreAnimation/CoreAnimationLayer.swift +14 -2
  25. package/Sources/Private/CoreAnimation/Extensions/Keyframes+combined.swift +43 -9
  26. package/Sources/Private/CoreAnimation/Layers/ShapeItemLayer.swift +35 -12
  27. package/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift +142 -32
  28. package/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +4 -4
  29. package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +1 -1
  30. package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +1 -1
  31. package/Sources/Private/Model/DotLottie/DotLottieAnimation.swift +4 -7
  32. package/Sources/Private/Model/DotLottie/Zip/Data+Compression.swift +2 -2
  33. package/Sources/Private/Model/ShapeItems/GradientStroke.swift +53 -0
  34. package/Sources/Private/Model/ShapeItems/ShapeTransform.swift +9 -0
  35. package/Sources/Private/Model/ShapeItems/Stroke.swift +35 -0
  36. package/Sources/Private/Model/ShapeItems/Trim.swift +8 -0
  37. package/Sources/Private/Utility/Extensions/CGColor+RGB.swift +5 -7
  38. package/Sources/Public/Animation/LottieAnimationHelpers.swift +2 -2
  39. package/Sources/Public/Animation/LottieAnimationView.swift +13 -1
  40. package/Sources/Public/LottieConfiguration.swift +8 -1
  41. package/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift +123 -7
  42. package/lottie-ios.podspec +1 -3
  43. package/package.json +1 -1
@@ -52,6 +52,25 @@ jobs:
52
52
  name: TestArtifacts
53
53
  path: Tests/Artifacts
54
54
 
55
+ build-xcframework:
56
+ name: "Build XCFramework"
57
+ runs-on: macos-12
58
+ steps:
59
+ - uses: actions/checkout@v2
60
+ - uses: ./.github/actions/setup
61
+ with:
62
+ # XCFrameworks are forwards-compatible but not backwards-compatible.
63
+ # The Xcode version we use for this job is that oldest Xcode version that
64
+ # will be able to use these XCFrameworks and the lottie-spm package.
65
+ xcode: '13.2.1' # Swift 5.5.2
66
+ - name: Build XCFramework
67
+ run: bundle exec rake build:xcframework
68
+ - name: Upload XCFramework
69
+ uses: actions/upload-artifact@v2
70
+ with:
71
+ name: Lottie.xcframework
72
+ path: .build/archives/Lottie.xcframework.zip
73
+
55
74
  cocoapod:
56
75
  name: "Lint CocoaPods podspec"
57
76
  runs-on: macos-12
@@ -42,6 +42,7 @@
42
42
  2E450DAC283415D500E56D19 /* OpacityAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E450DAB283415D500E56D19 /* OpacityAnimation.swift */; };
43
43
  2E450DAD283415D500E56D19 /* OpacityAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E450DAB283415D500E56D19 /* OpacityAnimation.swift */; };
44
44
  2E450DAE283415D500E56D19 /* OpacityAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E450DAB283415D500E56D19 /* OpacityAnimation.swift */; };
45
+ 2E70F79F295BB6D30089A0EF /* CompatibleAnimationViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E70F79E295BB6D30089A0EF /* CompatibleAnimationViewTests.swift */; };
45
46
  2E72128327BB329C0027BC56 /* AnimationKeypathTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E72128227BB329C0027BC56 /* AnimationKeypathTests.swift */; };
46
47
  2E72128527BB32DB0027BC56 /* PerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E72128427BB32DB0027BC56 /* PerformanceTests.swift */; };
47
48
  2E8040B027A072B8006E74CB /* Lottie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E80409A27A0725D006E74CB /* Lottie.framework */; };
@@ -674,6 +675,7 @@
674
675
  2E044E262820536800FA773B /* AutomaticEngineTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutomaticEngineTests.swift; sourceTree = "<group>"; };
675
676
  2E09FA0527B6CEB600BA84E5 /* HardcodedFontProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HardcodedFontProvider.swift; sourceTree = "<group>"; };
676
677
  2E450DAB283415D500E56D19 /* OpacityAnimation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpacityAnimation.swift; sourceTree = "<group>"; };
678
+ 2E70F79E295BB6D30089A0EF /* CompatibleAnimationViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompatibleAnimationViewTests.swift; sourceTree = "<group>"; };
677
679
  2E72128227BB329C0027BC56 /* AnimationKeypathTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimationKeypathTests.swift; sourceTree = "<group>"; };
678
680
  2E72128427BB32DB0027BC56 /* PerformanceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerformanceTests.swift; sourceTree = "<group>"; };
679
681
  2E80409A27A0725D006E74CB /* Lottie.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Lottie.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -961,6 +963,7 @@
961
963
  6DB3BDB528243FA5002A276D /* ValueProvidersTests.swift */,
962
964
  D453D8AE28FF9BC600D3F49C /* AnimationCacheProviderTests.swift */,
963
965
  08CB2680291ED2B700B4F071 /* AnimationViewTests.swift */,
966
+ 2E70F79E295BB6D30089A0EF /* CompatibleAnimationViewTests.swift */,
964
967
  );
965
968
  path = Tests;
966
969
  sourceTree = "<group>";
@@ -2051,6 +2054,7 @@
2051
2054
  2E80450D27A07347006E74CB /* SnapshotConfiguration.swift in Sources */,
2052
2055
  6DEF696E2824A76C007D640F /* BundleTests.swift in Sources */,
2053
2056
  2EAF59A727A076BC00E00531 /* Bundle+Module.swift in Sources */,
2057
+ 2E70F79F295BB6D30089A0EF /* CompatibleAnimationViewTests.swift in Sources */,
2054
2058
  2E8044AE27A07347006E74CB /* Snapshotting+presentationLayer.swift in Sources */,
2055
2059
  36E57EAC28AF7ADF00B7EFDA /* HardcodedTextProvider.swift in Sources */,
2056
2060
  2E72128527BB32DB0027BC56 /* PerformanceTests.swift in Sources */,
@@ -7,17 +7,17 @@
7
7
  <key>Lottie (iOS).xcscheme_^#shared#^_</key>
8
8
  <dict>
9
9
  <key>orderHint</key>
10
- <integer>1</integer>
10
+ <integer>2</integer>
11
11
  </dict>
12
12
  <key>Lottie (macOS).xcscheme_^#shared#^_</key>
13
13
  <dict>
14
14
  <key>orderHint</key>
15
- <integer>2</integer>
15
+ <integer>4</integer>
16
16
  </dict>
17
17
  <key>Lottie (tvOS).xcscheme_^#shared#^_</key>
18
18
  <dict>
19
19
  <key>orderHint</key>
20
- <integer>3</integer>
20
+ <integer>5</integer>
21
21
  </dict>
22
22
  </dict>
23
23
  </dict>
@@ -24,8 +24,8 @@
24
24
  "repositoryURL": "https://github.com/airbnb/swift",
25
25
  "state": {
26
26
  "branch": null,
27
- "revision": "7884f265499752cc5eccaa9eba08b4a2f8b73357",
28
- "version": null
27
+ "revision": "07bb2e0822ca6e464bf3610ed452568931fdbf65",
28
+ "version": "1.0.3"
29
29
  }
30
30
  },
31
31
  {
@@ -5,12 +5,67 @@
5
5
  version = "2.0">
6
6
  <Breakpoints>
7
7
  <BreakpointProxy
8
- BreakpointExtensionID = "Xcode.Breakpoint.SwiftErrorBreakpoint">
8
+ BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
9
9
  <BreakpointContent
10
- uuid = "C6EE3985-FE51-481D-807F-F4B9BE9FB067"
10
+ uuid = "9DC6749B-AFBA-42EA-B760-D50A245DEC24"
11
11
  shouldBeEnabled = "No"
12
12
  ignoreCount = "0"
13
- continueAfterRunningActions = "No">
13
+ continueAfterRunningActions = "No"
14
+ filePath = "Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift"
15
+ startingColumnNumber = "9223372036854775807"
16
+ endingColumnNumber = "9223372036854775807"
17
+ startingLineNumber = "137"
18
+ endingLineNumber = "137"
19
+ landmarkName = "rebuildOutputs(frame:)"
20
+ landmarkType = "7">
21
+ <Locations>
22
+ <Location
23
+ uuid = "9DC6749B-AFBA-42EA-B760-D50A245DEC24 - f0c945e8360ca5fb"
24
+ shouldBeEnabled = "Yes"
25
+ ignoreCount = "0"
26
+ continueAfterRunningActions = "No"
27
+ symbolName = "Lottie.LayerTransformNode.rebuildOutputs(frame: CoreGraphics.CGFloat) -&gt; ()"
28
+ moduleName = "Lottie"
29
+ usesParentBreakpointCondition = "Yes"
30
+ urlString = "file:///Users/calstephens/Documents/lottie/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift"
31
+ startingColumnNumber = "9223372036854775807"
32
+ endingColumnNumber = "9223372036854775807"
33
+ startingLineNumber = "137"
34
+ endingLineNumber = "137"
35
+ offsetFromSymbolStart = "2042">
36
+ </Location>
37
+ <Location
38
+ uuid = "9DC6749B-AFBA-42EA-B760-D50A245DEC24 - f0c945e8360ca5fb"
39
+ shouldBeEnabled = "Yes"
40
+ ignoreCount = "0"
41
+ continueAfterRunningActions = "No"
42
+ symbolName = "Lottie.LayerTransformNode.rebuildOutputs(frame: CoreGraphics.CGFloat) -&gt; ()"
43
+ moduleName = "Lottie"
44
+ usesParentBreakpointCondition = "Yes"
45
+ urlString = "file:///Users/calstephens/Documents/lottie/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift"
46
+ startingColumnNumber = "9223372036854775807"
47
+ endingColumnNumber = "9223372036854775807"
48
+ startingLineNumber = "137"
49
+ endingLineNumber = "137"
50
+ offsetFromSymbolStart = "2258">
51
+ </Location>
52
+ </Locations>
53
+ </BreakpointContent>
54
+ </BreakpointProxy>
55
+ <BreakpointProxy
56
+ BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
57
+ <BreakpointContent
58
+ uuid = "69613CF7-1A73-4964-BA21-D493D8A4F285"
59
+ shouldBeEnabled = "No"
60
+ ignoreCount = "0"
61
+ continueAfterRunningActions = "No"
62
+ filePath = "Sources/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift"
63
+ startingColumnNumber = "9223372036854775807"
64
+ endingColumnNumber = "9223372036854775807"
65
+ startingLineNumber = "24"
66
+ endingLineNumber = "24"
67
+ landmarkName = "timed(with:for:)"
68
+ landmarkType = "7">
14
69
  </BreakpointContent>
15
70
  </BreakpointProxy>
16
71
  </Breakpoints>
@@ -3,59 +3,88 @@
3
3
  version = "1.0">
4
4
  <ContextStates>
5
5
  <ContextState
6
- contextName = "closure #1 in CAShapeLayer.addAnimations(for:context:pathMultiplier:transformPath:):CustomPathAnimation.swift">
6
+ contextName = "CAShapeLayer.addStrokeAnimations(for:context:):StrokeAnimation.swift">
7
7
  <PersistentStrings>
8
8
  <PersistentString
9
- value = "UIBezierPath(cgPath: pathKeyframe.cgPath())">
9
+ value = "UIColor(cgColor: strokeColor.keyframes[0].value.cgColorValue)">
10
10
  </PersistentString>
11
+ </PersistentStrings>
12
+ </ContextState>
13
+ <ContextState
14
+ contextName = "ShapeItemLayer.setupSolidFillAnimations(shapeLayer:context:):ShapeItemLayer.swift">
15
+ <PersistentStrings>
11
16
  <PersistentString
12
- value = "path.boundingBox">
17
+ value = "fill.color.keyframes.last!.value.cgColorValue">
13
18
  </PersistentString>
14
19
  </PersistentStrings>
15
20
  </ContextState>
16
21
  <ContextState
17
- contextName = "closure #1 in CAShapeLayer.addAnimations(for:context:pathMultiplier:):CombinedShapeAnimation.swift">
22
+ contextName = "closure #1 in CAShapeLayer.addStarAnimation(for:context:pathMultiplier:):StarAnimation.swift">
18
23
  <PersistentStrings>
19
24
  <PersistentString
20
- value = "UIBezierPath(cgPath: combinedPath)">
25
+ value = "UIBezierPath(cgPath: path)">
21
26
  </PersistentString>
22
27
  </PersistentStrings>
23
28
  </ContextState>
24
29
  <ContextState
25
- contextName = "closure #2 in GradientRenderLayer.addGradientAnimations(for:type:context:):GradientAnimations.swift">
30
+ contextName = "GradientRenderLayer.addGradientAnimations(for:type:context:):GradientAnimations.swift">
31
+ </ContextState>
32
+ <ContextState
33
+ contextName = "MaskCompositionLayer.init(masks:):MaskCompositionLayer.swift">
34
+ </ContextState>
35
+ <ContextState
36
+ contextName = "GroupLayer.init(group:inheritedItems:context:):ShapeLayer.swift">
37
+ </ContextState>
38
+ <ContextState
39
+ contextName = "ShapeNode.rebuildOutputs(frame:):ShapeNode.swift">
26
40
  <PersistentStrings>
27
41
  <PersistentString
28
- value = "gradient.colorConfiguration(from: colorComponents, type: type)">
42
+ value = "properties.path">
29
43
  </PersistentString>
30
44
  </PersistentStrings>
31
45
  </ContextState>
32
46
  <ContextState
33
- contextName = "closure #1 in MaskCompositionLayer.MaskLayer.setupAnimations(context:):MaskCompositionLayer.swift">
47
+ contextName = "FillNode.rebuildOutputs(frame:):FillNode.swift">
34
48
  <PersistentStrings>
35
49
  <PersistentString
36
- value = "UIBezierPath(cgPath: maskPath)">
50
+ value = "fillProperties.color.value.cgColorValue">
37
51
  </PersistentString>
38
52
  </PersistentStrings>
39
53
  </ContextState>
40
54
  <ContextState
41
- contextName = "GradientRenderLayer.addGradientAnimations(for:type:context:):GradientAnimations.swift">
55
+ contextName = "CALayer.addPositionAnimations(from:context:):TransformAnimations.swift">
42
56
  </ContextState>
43
57
  <ContextState
44
- contextName = "ShapeNodeProperties.init(shape:):ShapeNode.swift">
58
+ contextName = "CALayer.makeGroupLayers(from:parentGroup:context:):ShapeLayer.swift">
59
+ </ContextState>
60
+ <ContextState
61
+ contextName = "Array&lt;&#x3c4;_0_0&gt;.shapeRenderGroups(groupHasChildGroupsToInheritUnusedItems:):ShapeLayer.swift">
62
+ </ContextState>
63
+ <ContextState
64
+ contextName = "CALayer.path&lt;&#x3c4;_0_0&gt;(keyframes:value:):CALayer+addAnimation.swift">
45
65
  <PersistentStrings>
46
66
  <PersistentString
47
- value = "UIBezierPath(cgPath: shape.path.keyframes[0].value.cgPath())">
67
+ value = "UIBezierPath(cgPath: path)">
48
68
  </PersistentString>
49
69
  </PersistentStrings>
50
70
  </ContextState>
51
71
  <ContextState
52
- contextName = "ShapeNode.rebuildOutputs(frame:):ShapeNode.swift">
72
+ contextName = "closure #2 in GradientRenderLayer.addGradientAnimations(for:type:context:):GradientAnimations.swift">
53
73
  <PersistentStrings>
54
74
  <PersistentString
55
- value = "properties.path">
75
+ value = "gradient.colorConfiguration(from: colorComponents, type: type)">
56
76
  </PersistentString>
57
77
  </PersistentStrings>
58
78
  </ContextState>
79
+ <ContextState
80
+ contextName = "closure #5 in CALayer.makeGroupLayers(from:parentGroup:parentGroupPath:context:):ShapeLayer.swift">
81
+ </ContextState>
82
+ <ContextState
83
+ contextName = "Array&lt;&#x3c4;_0_0&gt;.shapeRenderGroups.getter:ShapeLayer.swift">
84
+ </ContextState>
85
+ <ContextState
86
+ contextName = "closure #1 in CALayer.addRotationAnimation(from:context:):TransformAnimations.swift">
87
+ </ContextState>
59
88
  <ContextState
60
89
  contextName = "MaskLayer.updateWithFrame(frame:forceUpdates:):MaskContainerLayer.swift">
61
90
  <PersistentStrings>
@@ -65,35 +94,56 @@
65
94
  </PersistentStrings>
66
95
  </ContextState>
67
96
  <ContextState
68
- contextName = "MaskCompositionLayer.init(masks:):MaskCompositionLayer.swift">
97
+ contextName = "CALayer.makeGroupLayers(from:parentGroup:parentGroupPath:context:):ShapeLayer.swift">
98
+ </ContextState>
99
+ <ContextState
100
+ contextName = "CALayer.addRotationAnimation(from:context:):TransformAnimations.swift">
101
+ </ContextState>
102
+ <ContextState
103
+ contextName = "closure #4 in CALayer.makeGroupLayers(from:parentGroup:parentGroupPath:context:):ShapeLayer.swift">
104
+ </ContextState>
105
+ <ContextState
106
+ contextName = "GroupLayer.init(group:items:groupPath:context:):ShapeLayer.swift">
107
+ </ContextState>
108
+ <ContextState
109
+ contextName = "CALayer.addTransformAnimations(for:context:):TransformAnimations.swift">
110
+ </ContextState>
111
+ <ContextState
112
+ contextName = "CALayer.keyframeAnimation&lt;&#x3c4;_0_0, &#x3c4;_0_1&gt;(for:keyframes:value:context:):CALayer+addAnimation.swift">
69
113
  </ContextState>
70
114
  <ContextState
71
115
  contextName = "CoreAnimationLayer.init(animation:imageProvider:fontProvider:compatibilityTrackerMode:logger:):CoreAnimationLayer.swift">
72
116
  </ContextState>
73
117
  <ContextState
74
- contextName = "closure #1 in CAShapeLayer.addAnimations(for:context:pathMultiplier:):RectangleAnimation.swift">
118
+ contextName = "CoreAnimationLayer.display():CoreAnimationLayer.swift">
75
119
  <PersistentStrings>
76
120
  <PersistentString
77
- value = "UIBezierPath(cgPath: BezierPath.rectangle(position: keyframe.position.pointValue, size: keyframe.size.sizeValue, cornerRadius: keyframe.cornerRadius.cgFloatValue, direction: rectangle.direction).cgPath())">
121
+ value = "(superlayer!.delegate! as! UIView).superview!">
122
+ </PersistentString>
123
+ <PersistentString
124
+ value = "(superlayer!.delegate! as! UIView).window">
78
125
  </PersistentString>
79
126
  </PersistentStrings>
80
127
  </ContextState>
81
128
  <ContextState
82
- contextName = "Array&lt;&#x3c4;_0_0&gt;.shapeRenderGroups.getter:ShapeLayer.swift">
83
- </ContextState>
84
- <ContextState
85
- contextName = "CALayer.path&lt;&#x3c4;_0_0&gt;(keyframes:value:):CALayer+addAnimation.swift">
129
+ contextName = "closure #1 in CAShapeLayer.addAnimations(for:context:pathMultiplier:transformPath:):CustomPathAnimation.swift">
86
130
  <PersistentStrings>
87
131
  <PersistentString
88
- value = "UIBezierPath(cgPath: path)">
132
+ value = "UIBezierPath(cgPath: pathKeyframe.cgPath())">
133
+ </PersistentString>
134
+ <PersistentString
135
+ value = "path.boundingBox">
89
136
  </PersistentString>
90
137
  </PersistentStrings>
91
138
  </ContextState>
92
139
  <ContextState
93
- contextName = "CAShapeLayer.addStrokeAnimations(for:context:):StrokeAnimation.swift">
140
+ contextName = "CoreAnimationLayer.init(animation:imageProvider:textProvider:fontProvider:compatibilityTrackerMode:logger:):CoreAnimationLayer.swift">
141
+ </ContextState>
142
+ <ContextState
143
+ contextName = "closure #1 in CAShapeLayer.addAnimations(for:context:pathMultiplier:):RectangleAnimation.swift">
94
144
  <PersistentStrings>
95
145
  <PersistentString
96
- value = "UIColor(cgColor: strokeColor.keyframes[0].value.cgColorValue)">
146
+ value = "UIBezierPath(cgPath: BezierPath.rectangle(position: keyframe.position.pointValue, size: keyframe.size.sizeValue, cornerRadius: keyframe.cornerRadius.cgFloatValue, direction: rectangle.direction).cgPath())">
97
147
  </PersistentString>
98
148
  </PersistentStrings>
99
149
  </ContextState>
@@ -101,10 +151,10 @@
101
151
  contextName = "Collection&lt;&gt;.pairedLayersAndMasks(context:):CALayer+setupLayerHierarchy.swift">
102
152
  </ContextState>
103
153
  <ContextState
104
- contextName = "ShapeItemLayer.setupSolidFillAnimations(shapeLayer:context:):ShapeItemLayer.swift">
154
+ contextName = "closure #1 in MaskCompositionLayer.MaskLayer.setupAnimations(context:):MaskCompositionLayer.swift">
105
155
  <PersistentStrings>
106
156
  <PersistentString
107
- value = "fill.color.keyframes.last!.value.cgColorValue">
157
+ value = "UIBezierPath(cgPath: maskPath)">
108
158
  </PersistentString>
109
159
  </PersistentStrings>
110
160
  </ContextState>
@@ -112,27 +162,48 @@
112
162
  contextName = "ShapeItemLayer.init(shape:otherItems:context:):ShapeItemLayer.swift">
113
163
  </ContextState>
114
164
  <ContextState
115
- contextName = "FillNode.rebuildOutputs(frame:):FillNode.swift">
165
+ contextName = "CALayer.setupGroups(from:parentGroup:parentGroupPath:context:):ShapeLayer.swift">
166
+ </ContextState>
167
+ <ContextState
168
+ contextName = "BaseCompositionLayer.setupLayerAnimations(context:):BaseCompositionLayer.swift">
116
169
  <PersistentStrings>
117
170
  <PersistentString
118
- value = "fillProperties.color.value.cgColorValue">
171
+ value = "baseLayerModel.transform.rotation.keyframes.count &gt; 1">
119
172
  </PersistentString>
120
173
  </PersistentStrings>
121
174
  </ContextState>
122
175
  <ContextState
123
- contextName = "CALayer.keyframeAnimation&lt;&#x3c4;_0_0, &#x3c4;_0_1&gt;(for:keyframes:value:context:):CALayer+addAnimation.swift">
176
+ contextName = "BaseCompositionLayer.setupAnimations(context:):BaseCompositionLayer.swift">
124
177
  </ContextState>
125
178
  <ContextState
126
- contextName = "CALayer.makeGroupLayers(from:parentGroup:context:):ShapeLayer.swift">
179
+ contextName = "closure #1 in CAShapeLayer.addAnimations(for:context:pathMultiplier:):CombinedShapeAnimation.swift">
180
+ <PersistentStrings>
181
+ <PersistentString
182
+ value = "UIBezierPath(cgPath: combinedPath)">
183
+ </PersistentString>
184
+ </PersistentStrings>
127
185
  </ContextState>
128
186
  <ContextState
129
- contextName = "CALayer.addPositionAnimations(from:context:):TransformAnimations.swift">
187
+ contextName = "ShapeNodeProperties.init(shape:):ShapeNode.swift">
188
+ <PersistentStrings>
189
+ <PersistentString
190
+ value = "UIBezierPath(cgPath: shape.path.keyframes[0].value.cgPath())">
191
+ </PersistentString>
192
+ </PersistentStrings>
130
193
  </ContextState>
131
194
  <ContextState
132
- contextName = "closure #1 in Array&lt;&#x3c4;_0_0&gt;.shapeRenderGroups.getter:ShapeLayer.swift">
195
+ contextName = "GroupLayer.setupLayerHierarchy(context:):ShapeLayer.swift">
196
+ <PersistentStrings>
197
+ <PersistentString
198
+ value = "nonGroupItems">
199
+ </PersistentString>
200
+ <PersistentString
201
+ value = "items.shapeRenderGroups(groupHasChildGroupsToInheritUnusedItems: !childGroups.isEmpty)">
202
+ </PersistentString>
203
+ </PersistentStrings>
133
204
  </ContextState>
134
205
  <ContextState
135
- contextName = "GroupLayer.init(group:inheritedItems:context:):ShapeLayer.swift">
206
+ contextName = "closure #1 in Array&lt;&#x3c4;_0_0&gt;.shapeRenderGroups.getter:ShapeLayer.swift">
136
207
  </ContextState>
137
208
  </ContextStates>
138
209
  </VariablesViewState>
@@ -25,6 +25,13 @@
25
25
  <key>orderHint</key>
26
26
  <integer>4</integer>
27
27
  </dict>
28
+ <key>Tools for plug-in “FormatSwift”.xcscheme</key>
29
+ <dict>
30
+ <key>isShown</key>
31
+ <false/>
32
+ <key>orderHint</key>
33
+ <integer>8</integer>
34
+ </dict>
28
35
  </dict>
29
36
  </dict>
30
37
  </plist>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>LottieAnimation.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>6</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Bucket
3
+ uuid = "C335EAC3-CB4B-41DF-9652-0EB8DE739C92"
4
+ type = "1"
5
+ version = "2.0">
6
+ </Bucket>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>LottieAnimation.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,25 @@
1
+ {
2
+ "object": {
3
+ "pins": [
4
+ {
5
+ "package": "AirbnbSwift",
6
+ "repositoryURL": "https://github.com/airbnb/swift",
7
+ "state": {
8
+ "branch": null,
9
+ "revision": "07bb2e0822ca6e464bf3610ed452568931fdbf65",
10
+ "version": "1.0.3"
11
+ }
12
+ },
13
+ {
14
+ "package": "swift-argument-parser",
15
+ "repositoryURL": "https://github.com/apple/swift-argument-parser",
16
+ "state": {
17
+ "branch": null,
18
+ "revision": "df9ee6676cd5b3bf5b330ec7568a5644f547201b",
19
+ "version": "1.1.3"
20
+ }
21
+ }
22
+ ]
23
+ },
24
+ "version": 1
25
+ }
package/Package.swift CHANGED
@@ -6,3 +6,8 @@ let package = Package(
6
6
  platforms: [.iOS("11.0"), .macOS("10.10"), .tvOS("11.0")],
7
7
  products: [.library(name: "Lottie", targets: ["Lottie"])],
8
8
  targets: [.target(name: "Lottie", path: "Sources")])
9
+
10
+ #if swift(>=5.6)
11
+ // Add the Airbnb Swift formatting plugin if possible
12
+ package.dependencies.append(.package(url: "https://github.com/airbnb/swift", .upToNextMajor(from: "1.0.1")))
13
+ #endif
package/README.md CHANGED
@@ -33,10 +33,20 @@ You can pull the [Lottie Github Repo](https://github.com/airbnb/lottie-ios/) and
33
33
 
34
34
  ### Swift Package Manager
35
35
 
36
- To install Lottie using [Swift Package Manager](https://github.com/apple/swift-package-manager) you can follow the [tutorial published by Apple](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) using the URL for the Lottie repo with the current version:
36
+ To install Lottie using [Swift Package Manager](https://github.com/apple/swift-package-manager) you can follow the [tutorial published by Apple](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) using the URL for the Lottie repo with the current version:
37
37
 
38
- 1. In Xcode, select “File” → “Swift Packages” → “Add Package Dependency”
39
- 1. Enter https://github.com/airbnb/lottie-ios.git
38
+ 1. In Xcode, select “File” → “Add Packages...”
39
+ 1. Enter https://github.com/airbnb/lottie-spm.git
40
+
41
+ or you can add the following dependency to your `Package.swift`:
42
+
43
+ ```swift
44
+ .package(url: "https://github.com/airbnb/lottie-spm.git", from: "4.1.0")
45
+ ```
46
+
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 hsitory. The [lottie-spm](https://github.com/airbnb/lottie-spm) repo is much smaller (less than 500kb), so can be downloaded much more quickly.
48
+
49
+ Instead of downloading the full git history of Lottie and building it from source, the lottie-spm repo just contains a pointer to the precompiled XCFramework included in the [latest lottie-ios release](https://github.com/airbnb/lottie-ios/releases/latest) (typically ~8MB). If you prefer to include Lottie source directly your project, you can directly depend on the main lottie-ios repo by referencing `https://github.com/airbnb/lottie-ios.git` instead.
40
50
 
41
51
  ### CocoaPods
42
52
  Add the pod to your Podfile:
@@ -52,6 +62,7 @@ After installing the cocoapod into your project import Lottie with
52
62
  ```swift
53
63
  import Lottie
54
64
  ```
65
+
55
66
  ### Carthage
56
67
  Add Lottie to your Cartfile:
57
68
  ```
package/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  namespace :build do
2
2
  desc 'Builds all packages and executables'
3
- task all: ['package:all', 'example:all']
3
+ task all: ['package:all', 'example:all', 'xcframework']
4
4
 
5
5
  desc 'Builds the Lottie package for supported platforms'
6
6
  namespace :package do
@@ -43,6 +43,30 @@ namespace :build do
43
43
  xcodebuild('build -scheme "Example (tvOS)" -destination "platform=tvOS Simulator,name=Apple TV" -workspace Lottie.xcworkspace')
44
44
  end
45
45
  end
46
+
47
+ desc 'Builds an xcframework for all supported platforms'
48
+ task :xcframework do
49
+ sh 'rm -rf .build/archives'
50
+ xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (iOS)" -destination generic/platform=iOS -archivePath ".build/archives/Lottie_iOS" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES')
51
+ xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (iOS)" -destination "generic/platform=iOS Simulator" -archivePath ".build/archives/Lottie_iOS_Simulator" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES')
52
+ xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (macOS)" -destination generic/platform=macOS -archivePath ".build/archives/Lottie_macOS" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES')
53
+ xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (tvOS)" -destination generic/platform=tvOS -archivePath ".build/archives/Lottie_tvOS" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES')
54
+ xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (tvOS)" -destination "generic/platform=tvOS Simulator" -archivePath ".build/archives/Lottie_tvOS_Simulator" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES')
55
+ xcodebuild(
56
+ [
57
+ '-create-xcframework',
58
+ '-framework .build/archives/Lottie_iOS.xcarchive/Products/Library/Frameworks/Lottie.framework',
59
+ '-framework .build/archives/Lottie_iOS_Simulator.xcarchive/Products/Library/Frameworks/Lottie.framework',
60
+ '-framework .build/archives/Lottie_macOS.xcarchive/Products/Library/Frameworks/Lottie.framework',
61
+ '-framework .build/archives/Lottie_tvOS.xcarchive/Products/Library/Frameworks/Lottie.framework',
62
+ '-framework .build/archives/Lottie_tvOS_Simulator.xcarchive/Products/Library/Frameworks/Lottie.framework',
63
+ '-output .build/archives/Lottie.xcframework'
64
+ ].join(" "))
65
+ Dir.chdir('.build/archives') do
66
+ sh 'zip -r Lottie.xcframework.zip Lottie.xcframework'
67
+ end
68
+ sh 'swift package compute-checksum .build/archives/Lottie.xcframework.zip'
69
+ end
46
70
  end
47
71
 
48
72
  namespace :test do
@@ -93,7 +117,7 @@ end
93
117
  namespace :lint do
94
118
  desc 'Lints swift files'
95
119
  task :swift do
96
- formatTool('format --lint')
120
+ sh 'swift package --allow-writing-to-package-directory format --lint'
97
121
  end
98
122
 
99
123
  desc 'Lints the CocoaPods podspec'
@@ -105,7 +129,7 @@ end
105
129
  namespace :format do
106
130
  desc 'Formats swift files'
107
131
  task :swift do
108
- formatTool('format')
132
+ sh 'swift package --allow-writing-to-package-directory format'
109
133
  end
110
134
  end
111
135
 
@@ -119,42 +143,3 @@ def xcodebuild(command)
119
143
  sh "xcodebuild #{command}"
120
144
  end
121
145
  end
122
-
123
- def formatTool(command)
124
- # As of Xcode 13.4 / Xcode 14 beta 4, including airbnb/swift as a dependency
125
- # causes Xcode to spin indefinitely at 100% CPU (due to the remote binary dependencies
126
- # used by that package). As a workaround, we can specifically add that dependency
127
- # to our Package.swift file when linting / formatting and remove it afterwards.
128
- packageDefinition = File.read('Package.swift')
129
- packageDefinitionWithFormatDependency = packageDefinition +
130
- <<~EOC
131
-
132
- #if swift(>=5.6)
133
- // Add the Airbnb Swift formatting plugin if possible
134
- package.dependencies.append(
135
- .package(
136
- url: "https://github.com/airbnb/swift",
137
- // Since we don't have a Package.resolved for this, we need to reference a specific commit
138
- // so changes to the style guide don't cause this repo's checks to start failing.
139
- .revision("7884f265499752cc5eccaa9eba08b4a2f8b73357")))
140
- #endif
141
- EOC
142
-
143
- # Add the format tool dependency to our Package.swift
144
- File.write('Package.swift', packageDefinitionWithFormatDependency)
145
-
146
- exitCode = 0
147
-
148
- # Run the given command
149
- begin
150
- sh "swift package --allow-writing-to-package-directory #{command}"
151
- rescue
152
- exitCode = $?.exitstatus
153
- ensure
154
- # Revert the changes to Package.swift
155
- File.write('Package.swift', packageDefinition)
156
- File.delete('Package.resolved')
157
- end
158
-
159
- exit exitCode
160
- end