lottie-ios 4.2.0 → 4.3.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 +117 -11
- package/Gemfile +1 -0
- package/Gemfile.lock +5 -0
- package/Lottie.xcodeproj/project.pbxproj +1542 -194
- package/Lottie.xcodeproj/project.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcodeproj/xcshareddata/xcschemes/Lottie (iOS).xcscheme +1 -1
- package/Lottie.xcodeproj/xcshareddata/xcschemes/Lottie (macOS).xcscheme +1 -1
- package/Lottie.xcodeproj/xcshareddata/xcschemes/Lottie (tvOS).xcscheme +4 -5
- package/Lottie.xcodeproj/xcshareddata/xcschemes/Lottie (visionOS).xcscheme +66 -0
- package/Lottie.xcodeproj/xcuserdata/calstephens.xcuserdatad/xcschemes/xcschememanagement.plist +18 -0
- package/Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved +2 -11
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +346 -102
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Expressions.xcexplist +16 -5
- package/Package.resolved +2 -2
- package/Package.swift +16 -9
- package/README.md +2 -2
- package/Rakefile +122 -25
- package/Sources/Private/CoreAnimation/Animations/DropShadowAnimation.swift +160 -0
- package/Sources/Private/CoreAnimation/Animations/LayerProperty.swift +83 -10
- package/Sources/Private/CoreAnimation/Animations/TransformAnimations.swift +85 -79
- package/Sources/Private/CoreAnimation/CoreAnimationLayer.swift +7 -7
- package/Sources/Private/CoreAnimation/Extensions/Keyframes+combined.swift +67 -6
- package/Sources/Private/CoreAnimation/Layers/AnimationLayer.swift +2 -2
- package/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +9 -0
- package/Sources/Private/CoreAnimation/Layers/ImageLayer.swift +1 -0
- package/Sources/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +1 -1
- package/Sources/Private/CoreAnimation/Layers/RepeaterLayer.swift +2 -0
- package/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift +11 -13
- package/Sources/Private/CoreAnimation/Layers/SolidLayer.swift +20 -5
- package/Sources/Private/CoreAnimation/Layers/TextLayer.swift +13 -3
- package/Sources/Private/CoreAnimation/ValueProviderStore.swift +6 -4
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +263 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +18 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +32 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +99 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +29 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +57 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +41 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +60 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +37 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/README.md +31 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift +46 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift +391 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +44 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +51 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +172 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +128 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +452 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +148 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +40 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +43 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +42 -0
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +51 -0
- package/Sources/Private/EmbeddedLibraries/README.md +27 -0
- package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive+BackingConfiguration.swift +4 -4
- package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive+MemoryFile.swift +2 -2
- package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive+Writing.swift +4 -4
- package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive.swift +8 -7
- package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Data+Compression.swift +5 -5
- package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/FileManager+ZIP.swift +4 -4
- package/Sources/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +6 -0
- package/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +3 -1
- package/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +18 -5
- package/Sources/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +31 -3
- package/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +33 -8
- package/Sources/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +8 -1
- package/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +13 -4
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +2 -2
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +1 -0
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +4 -4
- package/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +1 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +3 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +2 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +2 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +1 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +2 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +1 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +1 -1
- package/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +6 -2
- package/Sources/Private/Model/Assets/Asset.swift +8 -0
- package/Sources/Private/Model/Assets/AssetLibrary.swift +2 -2
- package/Sources/Private/Model/Assets/ImageAsset.swift +3 -3
- package/Sources/Private/Model/DotLottie/DotLottieAnimation.swift +16 -2
- package/Sources/Private/Model/DotLottie/DotLottieImageProvider.swift +20 -7
- package/Sources/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +26 -0
- package/Sources/Private/Model/Keyframes/KeyframeGroup.swift +8 -5
- package/Sources/Private/Model/LayerEffects/DropShadowEffect.swift +45 -0
- package/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +38 -0
- package/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
- package/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +38 -0
- package/Sources/Private/Model/LayerEffects/LayerEffect.swift +103 -0
- package/Sources/Private/Model/LayerStyles/DropShadowStyle.swift +72 -0
- package/Sources/Private/Model/LayerStyles/LayerStyle.swift +85 -0
- package/Sources/Private/Model/Layers/LayerModel.swift +27 -0
- package/Sources/Private/Model/Objects/Marker.swift +1 -1
- package/Sources/Private/Model/Objects/Transform.swift +1 -2
- package/Sources/Private/Model/ShapeItems/GradientFill.swift +1 -1
- package/Sources/Private/Model/ShapeItems/GradientStroke.swift +2 -2
- package/Sources/Private/Model/ShapeItems/Merge.swift +1 -1
- package/Sources/Private/Model/ShapeItems/ShapeItem.swift +31 -26
- package/Sources/Private/Model/ShapeItems/ShapeTransform.swift +0 -9
- package/Sources/Private/Model/ShapeItems/Star.swift +1 -1
- package/Sources/Private/Model/Text/Font.swift +2 -2
- package/Sources/Private/Model/Text/Glyph.swift +1 -1
- package/Sources/Private/RootAnimationLayer.swift +2 -2
- package/Sources/Private/Utility/Debugging/LayerDebugging.swift +3 -1
- package/Sources/Private/Utility/Extensions/AnimationKeypathExtension.swift +32 -2
- package/Sources/Private/Utility/Helpers/AnimationContext.swift +4 -2
- package/Sources/Private/Utility/Helpers/AnyEquatable.swift +24 -0
- package/Sources/Private/Utility/Helpers/Binding+Map.swift +18 -0
- package/Sources/Private/Utility/Helpers/View+ValueChanged.swift +20 -0
- package/Sources/Private/Utility/LottieAnimationSource.swift +41 -0
- package/Sources/Private/Utility/Primitives/BezierPath.swift +2 -2
- package/Sources/Private/Utility/Primitives/BezierPathRoundExtension.swift +2 -2
- package/Sources/Private/Utility/Primitives/VectorsExtensions.swift +1 -1
- package/Sources/Public/Animation/LottieAnimation.swift +21 -2
- package/Sources/Public/Animation/LottieAnimationLayer.swift +1464 -0
- package/Sources/Public/Animation/LottieAnimationView.swift +258 -735
- package/Sources/Public/Animation/LottiePlaybackMode.swift +117 -0
- package/Sources/Public/Animation/LottieView.swift +462 -0
- package/Sources/Public/AnimationCache/AnimationCacheProvider.swift +2 -1
- package/Sources/Public/AnimationCache/DefaultAnimationCache.swift +5 -6
- package/Sources/Public/Configuration/DecodingStrategy.swift +15 -0
- package/Sources/Public/Configuration/LottieConfiguration.swift +47 -0
- package/Sources/Public/Configuration/ReducedMotionOption.swift +114 -0
- package/Sources/Public/{LottieConfiguration.swift → Configuration/RenderingEngineOption.swift} +2 -57
- package/Sources/Public/{iOS → Controls}/AnimatedButton.swift +56 -13
- package/Sources/Public/{iOS → Controls}/AnimatedControl.swift +80 -8
- package/Sources/Public/{iOS → Controls}/AnimatedSwitch.swift +71 -31
- package/Sources/Public/Controls/LottieButton.swift +122 -0
- package/Sources/Public/Controls/LottieSwitch.swift +144 -0
- package/Sources/Public/Controls/LottieViewType.swift +79 -0
- package/Sources/Public/DotLottie/DotLottieConfiguration.swift +24 -0
- package/Sources/Public/DotLottie/DotLottieFile.swift +21 -6
- package/Sources/Public/DotLottie/DotLottieFileHelpers.swift +79 -0
- package/Sources/Public/DynamicProperties/AnimationKeypath.swift +11 -1
- package/Sources/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +14 -0
- package/Sources/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +13 -0
- package/Sources/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +22 -5
- package/Sources/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +14 -0
- package/Sources/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +13 -0
- package/Sources/Public/FontProvider/AnimationFontProvider.swift +8 -0
- package/Sources/Public/ImageProvider/AnimationImageProvider.swift +24 -0
- package/Sources/Public/Keyframes/Keyframe.swift +6 -0
- package/Sources/Public/Primitives/Vectors.swift +2 -2
- package/Sources/Public/TextProvider/AnimationTextProvider.swift +79 -6
- package/Sources/Public/iOS/AnimationSubview.swift +1 -1
- package/Sources/Public/iOS/BundleImageProvider.swift +16 -2
- package/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift +2 -2
- package/Sources/Public/iOS/FilepathImageProvider.swift +22 -3
- package/Sources/Public/iOS/LottieAnimationViewBase.swift +7 -1
- package/Sources/Public/macOS/BundleImageProvider.macOS.swift +15 -1
- package/Sources/Public/macOS/FilepathImageProvider.macOS.swift +21 -2
- package/lottie-ios.podspec +2 -1
- package/package.json +1 -1
- package/Sources/Private/Model/DotLottie/DotLottieConfiguration.swift +0 -15
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive+Helpers.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive+Progress.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive+Reading.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive+ReadingDeprecated.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive+WritingDeprecated.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Archive+ZIP64.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Data+CompressionDeprecated.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Data+Serialization.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Entry+Serialization.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Entry+ZIP64.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/Entry.swift +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/README.md +0 -0
- /package/Sources/Private/{Model/DotLottie → EmbeddedLibraries}/ZipFoundation/URL+ZIP.swift +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Created by eric_horacek on 12/1/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - MakeViewProviding
|
|
5
|
+
|
|
6
|
+
/// The capability of constructing a `UIView`.
|
|
7
|
+
protocol MakeViewProviding {
|
|
8
|
+
/// The view constructed when the `MakeView` closure is called.
|
|
9
|
+
associatedtype View: ViewType
|
|
10
|
+
|
|
11
|
+
/// A closure that's called to construct an instance of `View`.
|
|
12
|
+
typealias MakeView = () -> View
|
|
13
|
+
|
|
14
|
+
/// A closure that's called to construct an instance of `View`.
|
|
15
|
+
var makeView: MakeView { get }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// MARK: - ViewEpoxyModeled
|
|
19
|
+
|
|
20
|
+
extension ViewEpoxyModeled where Self: MakeViewProviding {
|
|
21
|
+
|
|
22
|
+
// MARK: Internal
|
|
23
|
+
|
|
24
|
+
/// A closure that's called to construct an instance of `View` represented by this model.
|
|
25
|
+
var makeView: MakeView {
|
|
26
|
+
get { self[makeViewProperty] }
|
|
27
|
+
set { self[makeViewProperty] = newValue }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Replaces the default closure to construct the view with the given closure.
|
|
31
|
+
func makeView(_ value: @escaping MakeView) -> Self {
|
|
32
|
+
copy(updating: makeViewProperty, to: value)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// MARK: Private
|
|
36
|
+
|
|
37
|
+
private var makeViewProperty: EpoxyModelProperty<MakeView> {
|
|
38
|
+
// If you're getting a `EXC_BAD_INSTRUCTION` crash with this property in your stack trace, you
|
|
39
|
+
// probably either:
|
|
40
|
+
// - Conformed a view to `EpoxyableView` / `StyledView` with a custom initializer that
|
|
41
|
+
// takes parameters, or:
|
|
42
|
+
// - Used the `EpoxyModeled.init(dataID:)` initializer on a view has required initializer
|
|
43
|
+
// parameters.
|
|
44
|
+
// If you have parameters to view initialization, they should either be passed to `init(style:)`
|
|
45
|
+
// or you should provide a `makeView` closure when constructing your view's corresponding model,
|
|
46
|
+
// e.g:
|
|
47
|
+
// ```
|
|
48
|
+
// MyView.itemModel(…)
|
|
49
|
+
// .makeView { MyView(customParameter: …) }
|
|
50
|
+
// .styleID(…)
|
|
51
|
+
// ```
|
|
52
|
+
// Note that with the above approach that you must supply an `styleID` with the same identity as
|
|
53
|
+
// your view parameters to ensure that views with different parameters are not reused in place
|
|
54
|
+
// of one another.
|
|
55
|
+
.init(
|
|
56
|
+
keyPath: \Self.makeView,
|
|
57
|
+
defaultValue: View.init,
|
|
58
|
+
updateStrategy: .replace)
|
|
59
|
+
}
|
|
60
|
+
}
|
package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Created by eric_horacek on 12/2/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - SetBehaviorsProviding
|
|
5
|
+
|
|
6
|
+
/// A sentinel protocol for enabling an `CallbackContextEpoxyModeled` to provide a `setBehaviors`
|
|
7
|
+
/// closure property.
|
|
8
|
+
protocol SetBehaviorsProviding { }
|
|
9
|
+
|
|
10
|
+
// MARK: - CallbackContextEpoxyModeled
|
|
11
|
+
|
|
12
|
+
extension CallbackContextEpoxyModeled where Self: SetBehaviorsProviding {
|
|
13
|
+
|
|
14
|
+
// MARK: Internal
|
|
15
|
+
|
|
16
|
+
/// A closure that's called to set the content on this model's view with behaviors (e.g. tap handler
|
|
17
|
+
/// closures) whenever this model is updated.
|
|
18
|
+
typealias SetBehaviors = (CallbackContext) -> Void
|
|
19
|
+
|
|
20
|
+
/// A closure that's called to set the content on this model's view with behaviors (e.g. tap handler
|
|
21
|
+
/// closures) whenever this model is updated.
|
|
22
|
+
var setBehaviors: SetBehaviors? {
|
|
23
|
+
get { self[setBehaviorsProperty] }
|
|
24
|
+
set { self[setBehaviorsProperty] = newValue }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// Returns a copy of this model with the set behaviors closure called after the current set
|
|
28
|
+
/// behaviors closure of this model, if there is one.
|
|
29
|
+
func setBehaviors(_ value: SetBehaviors?) -> Self {
|
|
30
|
+
copy(updating: setBehaviorsProperty, to: value)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// MARK: Private
|
|
34
|
+
|
|
35
|
+
private var setBehaviorsProperty: EpoxyModelProperty<SetBehaviors?> {
|
|
36
|
+
.init(keyPath: \Self.setBehaviors, defaultValue: nil, updateStrategy: .chain())
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Created by eric_horacek on 12/1/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - SetContentProviding
|
|
5
|
+
|
|
6
|
+
/// A sentinel protocol for enabling an `CallbackContextEpoxyModeled` to provide a `setContent`
|
|
7
|
+
/// closure property.
|
|
8
|
+
protocol SetContentProviding { }
|
|
9
|
+
|
|
10
|
+
// MARK: - CallbackContextEpoxyModeled
|
|
11
|
+
|
|
12
|
+
extension CallbackContextEpoxyModeled where Self: SetContentProviding {
|
|
13
|
+
|
|
14
|
+
// MARK: Internal
|
|
15
|
+
|
|
16
|
+
/// A closure that's called to set the content on this model's view when it is first created and
|
|
17
|
+
/// subsequently when the content changes.
|
|
18
|
+
typealias SetContent = (CallbackContext) -> Void
|
|
19
|
+
|
|
20
|
+
/// A closure that's called to set the content on this model's view when it is first created and
|
|
21
|
+
/// subsequently when the content changes.
|
|
22
|
+
var setContent: SetContent? {
|
|
23
|
+
get { self[setContentProperty] }
|
|
24
|
+
set { self[setContentProperty] = newValue }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// Returns a copy of this model with the given setContent view closure called after the current
|
|
28
|
+
/// setContent view closure of this model, if there is one.
|
|
29
|
+
func setContent(_ value: SetContent?) -> Self {
|
|
30
|
+
copy(updating: setContentProperty, to: value)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// MARK: Private
|
|
34
|
+
|
|
35
|
+
private var setContentProperty: EpoxyModelProperty<SetContent?> {
|
|
36
|
+
.init(keyPath: \Self.setContent, defaultValue: nil, updateStrategy: .chain())
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Created by eric_horacek on 12/1/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - StyleIDProviding
|
|
5
|
+
|
|
6
|
+
protocol StyleIDProviding {
|
|
7
|
+
/// An optional ID for a style type to use for reuse of a view.
|
|
8
|
+
///
|
|
9
|
+
/// Use this to differentiate between different styling configurations.
|
|
10
|
+
var styleID: AnyHashable? { get }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// MARK: - EpoxyModeled
|
|
14
|
+
|
|
15
|
+
extension EpoxyModeled where Self: StyleIDProviding {
|
|
16
|
+
|
|
17
|
+
// MARK: Internal
|
|
18
|
+
|
|
19
|
+
var styleID: AnyHashable? {
|
|
20
|
+
get { self[styleIDProperty] }
|
|
21
|
+
set { self[styleIDProperty] = newValue }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// Returns a copy of this model with the `styleID` replaced with the provided `value`.
|
|
25
|
+
func styleID(_ value: AnyHashable?) -> Self {
|
|
26
|
+
copy(updating: styleIDProperty, to: value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// MARK: Private
|
|
30
|
+
|
|
31
|
+
private var styleIDProperty: EpoxyModelProperty<AnyHashable?> {
|
|
32
|
+
.init(
|
|
33
|
+
keyPath: \StyleIDProviding.styleID,
|
|
34
|
+
defaultValue: nil,
|
|
35
|
+
updateStrategy: .replace)
|
|
36
|
+
}
|
|
37
|
+
}
|
package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Created by eric_horacek on 12/16/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
#if !os(macOS)
|
|
5
|
+
import UIKit
|
|
6
|
+
|
|
7
|
+
/// The capability of providing a `UITraitCollection` instance.
|
|
8
|
+
///
|
|
9
|
+
/// Typically conformed to by the `CallbackContext` of a `CallbackContextEpoxyModeled`.
|
|
10
|
+
protocol TraitCollectionProviding {
|
|
11
|
+
/// The `UITraitCollection` instance provided by this type.
|
|
12
|
+
var traitCollection: UITraitCollection { get }
|
|
13
|
+
}
|
|
14
|
+
#endif
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Created by Bryan Keller on 12/17/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - ViewDifferentiatorProviding
|
|
5
|
+
|
|
6
|
+
/// The capability of providing a view differentiator that facilitates generating collection view
|
|
7
|
+
/// cell reuse identifiers.
|
|
8
|
+
protocol ViewDifferentiatorProviding {
|
|
9
|
+
/// The view differentiator for the item model.
|
|
10
|
+
var viewDifferentiator: ViewDifferentiator { get }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// MARK: - ViewDifferentiator
|
|
14
|
+
|
|
15
|
+
/// Facilitates differentiating between two models' views, based on their view type, optional style
|
|
16
|
+
/// identifier, and optional element kind for supplementary view models. If two models have the same
|
|
17
|
+
/// view differentiator, then they're compatible with one another for element reuse. If two models
|
|
18
|
+
/// have different view differentiators, then they're incompatible with one another for element
|
|
19
|
+
/// reuse.
|
|
20
|
+
struct ViewDifferentiator: Hashable {
|
|
21
|
+
|
|
22
|
+
// MARK: Lifecycle
|
|
23
|
+
|
|
24
|
+
init(viewType: AnyClass, styleID: AnyHashable?) {
|
|
25
|
+
viewTypeDescription = "\(type(of: viewType.self))"
|
|
26
|
+
self.styleID = styleID
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// MARK: Public
|
|
30
|
+
|
|
31
|
+
var viewTypeDescription: String
|
|
32
|
+
var styleID: AnyHashable?
|
|
33
|
+
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Created by eric_horacek on 12/16/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
/// The capability of providing an `View` instance
|
|
5
|
+
///
|
|
6
|
+
/// Typically conformed to by the `CallbackContext` of a `CallbackContextEpoxyModeled`.
|
|
7
|
+
protocol ViewProviding {
|
|
8
|
+
/// The `UIView` view of this type.
|
|
9
|
+
associatedtype View: ViewType
|
|
10
|
+
|
|
11
|
+
/// The `UIView` view instance provided by this type.
|
|
12
|
+
var view: View { get }
|
|
13
|
+
}
|
package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Created by eric_horacek on 12/15/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - WillDisplayProviding
|
|
5
|
+
|
|
6
|
+
/// A sentinel protocol for enabling an `CallbackContextEpoxyModeled` to provide a `willDisplay`
|
|
7
|
+
/// closure property.
|
|
8
|
+
///
|
|
9
|
+
/// - SeeAlso: `DidDisplayProviding`
|
|
10
|
+
/// - SeeAlso: `DidEndDisplayingProviding`
|
|
11
|
+
protocol WillDisplayProviding { }
|
|
12
|
+
|
|
13
|
+
// MARK: - CallbackContextEpoxyModeled
|
|
14
|
+
|
|
15
|
+
extension CallbackContextEpoxyModeled where Self: WillDisplayProviding {
|
|
16
|
+
|
|
17
|
+
// MARK: Internal
|
|
18
|
+
|
|
19
|
+
/// A closure that's called when a view is about to be displayed, before it has been added to the
|
|
20
|
+
/// view hierarcy.
|
|
21
|
+
typealias WillDisplay = (_ context: CallbackContext) -> Void
|
|
22
|
+
|
|
23
|
+
/// A closure that's called when the view is about to be displayed, before it has been added to
|
|
24
|
+
/// the view hierarcy.
|
|
25
|
+
var willDisplay: WillDisplay? {
|
|
26
|
+
get { self[willDisplayProperty] }
|
|
27
|
+
set { self[willDisplayProperty] = newValue }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Returns a copy of this model with the given will display closure called after the current will
|
|
31
|
+
/// display closure of this model, if there is one.
|
|
32
|
+
func willDisplay(_ value: WillDisplay?) -> Self {
|
|
33
|
+
copy(updating: willDisplayProperty, to: value)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// MARK: Private
|
|
37
|
+
|
|
38
|
+
private var willDisplayProperty: EpoxyModelProperty<WillDisplay?> {
|
|
39
|
+
.init(keyPath: \Self.willDisplay, defaultValue: nil, updateStrategy: .chain())
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Created by eric_horacek on 12/4/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
/// An Epoxy model with an associated `UIView` type.
|
|
5
|
+
protocol ViewEpoxyModeled: EpoxyModeled {
|
|
6
|
+
/// The view type associated with this model.
|
|
7
|
+
///
|
|
8
|
+
/// An instance of this view is typically configured by this model.
|
|
9
|
+
associatedtype View: ViewType
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
## EpoxyCore
|
|
2
|
+
|
|
3
|
+
This directory includes the source code of the EpoxyCore library, from the following release:
|
|
4
|
+
https://github.com/airbnb/epoxy-ios/releases/tag/0.10.0
|
|
5
|
+
|
|
6
|
+
Lottie is distributed via multiple package managers (SPM, Cocoapods, Carthage, and NPM),
|
|
7
|
+
each with different packaging and compilation requirements.
|
|
8
|
+
|
|
9
|
+
Due to limitations of these package managers, we can't depend on / import
|
|
10
|
+
a separate EpoxyCore module / library. Instead, we include the source
|
|
11
|
+
directly within the Lottie library and compile everything as a single unit.
|
|
12
|
+
|
|
13
|
+
### Update instructions
|
|
14
|
+
|
|
15
|
+
From time to time we may need to update to a more recent version of EpoxyCore.
|
|
16
|
+
When doing this, follow these steps:
|
|
17
|
+
|
|
18
|
+
1. Download the latest release from https://github.com/epoxy-ios/EpoxyCore
|
|
19
|
+
and replace the source code in this directory with the updated code.
|
|
20
|
+
|
|
21
|
+
2. Update the URL at the top of this file to indicate what release is being used.
|
|
22
|
+
|
|
23
|
+
3. Change all of the `public` symbols defined in this module to instead be `internal`
|
|
24
|
+
to prevent Lottie from exposing any EpoxyCore APIs.
|
|
25
|
+
|
|
26
|
+
4. Add `@available` annotations as necessary so the library compiles
|
|
27
|
+
(Lottie has a lower minimum iOS version than EpoxyCore).
|
|
28
|
+
|
|
29
|
+
5. Namespace any types that conflict with other existing types.
|
|
30
|
+
For example, the EpoxyCore `Entry` type conflicts with the ZipFoundation `Entry` type,
|
|
31
|
+
so the EpoxyCore type has been renamed to `EpoxyEntry`.
|
package/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Created by eric_horacek on 10/8/21.
|
|
2
|
+
// Copyright © 2021 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
#if !os(macOS)
|
|
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
|