From 71225b8c1fdd57463f3dba8796205084f2999cb2 Mon Sep 17 00:00:00 2001 From: Keita Watanabe Date: Mon, 15 Jul 2024 18:21:41 +0900 Subject: [PATCH] fix existential any --- .../Animations/CombinedShapeAnimation.swift | 2 +- .../Animations/DropShadowAnimation.swift | 10 +++--- .../Animations/GradientAnimations.swift | 6 ++-- .../Animations/LayerProperty.swift | 2 +- .../Animations/OpacityAnimation.swift | 2 +- .../Animations/StrokeAnimation.swift | 8 ++--- .../Animations/TransformAnimations.swift | 12 +++---- .../CoreAnimation/CoreAnimationLayer.swift | 20 +++++------ .../Extensions/CALayer+fillBounds.swift | 2 +- .../KeyframeGroup+exactlyOneKeyframe.swift | 2 +- .../Extensions/Keyframes+combined.swift | 4 +-- .../CoreAnimation/Layers/AnimationLayer.swift | 2 +- .../Layers/BaseAnimationLayer.swift | 2 +- .../Layers/BaseCompositionLayer.swift | 4 +-- .../LayerModel+makeAnimationLayer.swift | 6 ++-- .../CoreAnimation/Layers/ShapeLayer.swift | 6 ++-- .../CoreAnimation/Layers/TextLayer.swift | 2 +- .../CoreAnimation/ValueProviderStore.swift | 6 ++-- .../EpoxyCore/Diffing/Diffable.swift | 2 +- .../EpoxyCore/Model/EpoxyModelStorage.swift | 2 +- .../EpoxyCore/Model/EpoxyModeled.swift | 2 +- .../Model/Providers/DataIDProviding.swift | 2 +- .../Model/Providers/StyleIDProviding.swift | 2 +- .../ZipFoundation/Entry.swift | 4 +-- .../CompLayers/CompositionLayer.swift | 12 +++---- .../CompLayers/MaskContainerLayer.swift | 4 +-- .../CompLayers/PreCompositionLayer.swift | 6 ++-- .../CompLayers/ShapeCompositionLayer.swift | 2 +- .../CompLayers/SolidCompositionLayer.swift | 2 +- .../CompLayers/TextCompositionLayer.swift | 10 +++--- .../MainThreadAnimationLayer.swift | 20 +++++------ .../Utility/CachedImageProvider.swift | 6 ++-- .../CompositionLayersInitializer.swift | 4 +-- .../Utility/CoreTextRenderLayer.swift | 2 +- .../Utility/LayerFontProvider.swift | 4 +-- .../Utility/LayerImageProvider.swift | 4 +-- .../Utility/LayerTextProvider.swift | 4 +-- .../Utility/LayerTransformNode.swift | 14 ++++---- .../Extensions/ItemsExtension.swift | 8 ++--- .../NodeProperties/NodeProperty.swift | 10 +++--- .../Protocols/AnyNodeProperty.swift | 8 ++--- .../Protocols/KeypathSearchable.swift | 4 +-- .../Protocols/NodePropertyMap.swift | 4 +-- .../LayerEffectNodes/DropShadowNode.swift | 8 ++--- .../LayerEffectNodes/LayerEffectNode.swift | 2 +- .../ModifierNodes/RoundedCornersNode.swift | 12 +++---- .../Nodes/ModifierNodes/TrimPathNode.swift | 12 +++---- .../Nodes/OutputNodes/GroupOutputNode.swift | 6 ++-- .../OutputNodes/PassThroughOutputNode.swift | 4 +-- .../Nodes/OutputNodes/PathOutputNode.swift | 4 +-- .../Renderables/GradientFillRenderer.swift | 2 +- .../Renderables/GradientStrokeRenderer.swift | 2 +- .../Nodes/PathNodes/EllipseNode.swift | 10 +++--- .../Nodes/PathNodes/PolygonNode.swift | 12 +++---- .../Nodes/PathNodes/RectNode.swift | 10 +++--- .../Nodes/PathNodes/ShapeNode.swift | 10 +++--- .../Nodes/PathNodes/StarNode.swift | 10 +++--- .../Nodes/RenderContainers/GroupNode.swift | 20 +++++------ .../Nodes/RenderNodes/FillNode.swift | 12 +++---- .../Nodes/RenderNodes/GradientFillNode.swift | 12 +++---- .../RenderNodes/GradientStrokeNode.swift | 12 +++---- .../Nodes/RenderNodes/StrokeNode.swift | 12 +++---- .../Nodes/Text/TextAnimatorNode.swift | 14 ++++---- .../Protocols/AnimatorNode.swift | 12 +++---- .../NodeRenderSystem/Protocols/PathNode.swift | 2 +- .../Protocols/RenderNode.swift | 4 +-- .../RenderLayers/ShapeRenderLayer.swift | 4 +-- Sources/Private/Model/Assets/Asset.swift | 2 +- .../Private/Model/Assets/AssetLibrary.swift | 4 +-- Sources/Private/Model/Assets/ImageAsset.swift | 4 +-- .../Private/Model/Assets/PrecompAsset.swift | 4 +-- .../KeyedDecodingContainerExtensions.swift | 2 +- .../Model/Keyframes/KeyframeGroup.swift | 8 ++--- .../Model/LayerEffects/DropShadowEffect.swift | 2 +- .../EffectValues/ColorEffectValue.swift | 4 +-- .../EffectValues/EffectValue.swift | 4 +-- .../EffectValues/Vector1DEffectValue.swift | 4 +-- .../Model/LayerEffects/LayerEffect.swift | 4 +-- .../Model/LayerStyles/DropShadowStyle.swift | 4 +-- .../Model/LayerStyles/LayerStyle.swift | 4 +-- .../Model/Layers/ImageLayerModel.swift | 4 +-- Sources/Private/Model/Layers/LayerModel.swift | 4 +-- .../Model/Layers/PreCompLayerModel.swift | 4 +-- .../Model/Layers/ShapeLayerModel.swift | 4 +-- .../Model/Layers/SolidLayerModel.swift | 4 +-- .../Private/Model/Layers/TextLayerModel.swift | 4 +-- Sources/Private/Model/Objects/Mask.swift | 2 +- Sources/Private/Model/Objects/Transform.swift | 2 +- .../Private/Model/ShapeItems/Ellipse.swift | 4 +-- Sources/Private/Model/ShapeItems/Fill.swift | 4 +-- .../Model/ShapeItems/GradientFill.swift | 4 +-- .../Model/ShapeItems/GradientStroke.swift | 4 +-- Sources/Private/Model/ShapeItems/Group.swift | 4 +-- Sources/Private/Model/ShapeItems/Merge.swift | 4 +-- .../Private/Model/ShapeItems/Rectangle.swift | 4 +-- .../Private/Model/ShapeItems/Repeater.swift | 4 +-- .../Model/ShapeItems/RoundedCorners.swift | 4 +-- Sources/Private/Model/ShapeItems/Shape.swift | 4 +-- .../Private/Model/ShapeItems/ShapeItem.swift | 4 +-- .../Model/ShapeItems/ShapeTransform.swift | 4 +-- Sources/Private/Model/ShapeItems/Star.swift | 4 +-- Sources/Private/Model/ShapeItems/Stroke.swift | 4 +-- Sources/Private/Model/ShapeItems/Trim.swift | 4 +-- Sources/Private/Model/Text/Glyph.swift | 4 +-- Sources/Private/Model/Text/TextAnimator.swift | 4 +-- Sources/Private/RootAnimationLayer.swift | 10 +++--- .../Utility/Debugging/LayerDebugging.swift | 6 ++-- .../AnimationKeypathExtension.swift | 12 +++---- .../Utility/Helpers/AnimationContext.swift | 2 +- .../Utility/Primitives/BezierPath.swift | 4 +-- .../Utility/Primitives/ColorExtension.swift | 4 +-- .../Primitives/VectorsExtensions.swift | 12 +++---- .../Public/Animation/LottieAnimation.swift | 2 +- .../Animation/LottieAnimationHelpers.swift | 10 +++--- .../Animation/LottieAnimationLayer.swift | 24 ++++++------- .../Animation/LottieAnimationView.swift | 28 +++++++-------- .../LottieAnimationViewInitializers.swift | 34 +++++++++--------- Sources/Public/Animation/LottieView.swift | 8 ++--- .../AnimationCache/LottieAnimationCache.swift | 2 +- .../Configuration/ReducedMotionOption.swift | 2 +- Sources/Public/Controls/AnimatedControl.swift | 2 +- Sources/Public/Controls/AnimatedSwitch.swift | 2 +- .../DotLottie/DotLottieConfiguration.swift | 2 +- .../DotLottie/DotLottieFileHelpers.swift | 36 +++++++++---------- .../CompatibleAnimationView.swift | 2 +- 125 files changed, 399 insertions(+), 399 deletions(-) diff --git a/Sources/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift b/Sources/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift index e5b888f45e..df8b1710c6 100644 --- a/Sources/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +++ b/Sources/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift @@ -38,7 +38,7 @@ final class CombinedShapeItem: ShapeItem { super.init(name: name, type: .shape, hidden: false) } - required init(from _: Decoder) throws { + required init(from _: any Decoder) throws { fatalError("init(from:) has not been implemented") } diff --git a/Sources/Private/CoreAnimation/Animations/DropShadowAnimation.swift b/Sources/Private/CoreAnimation/Animations/DropShadowAnimation.swift index 92296390bb..ea508fe1da 100644 --- a/Sources/Private/CoreAnimation/Animations/DropShadowAnimation.swift +++ b/Sources/Private/CoreAnimation/Animations/DropShadowAnimation.swift @@ -84,7 +84,7 @@ extension CALayer { /// Adds drop shadow animations from the given `DropShadowModel` to this layer @nonobjc func addDropShadowAnimations( - for dropShadowModel: DropShadowModel, + for dropShadowModel: any DropShadowModel, context: LayerAnimationContext) throws { @@ -96,7 +96,7 @@ extension CALayer { // MARK: Private - private func addShadowOpacityAnimation(from model: DropShadowModel, context: LayerAnimationContext) throws { + private func addShadowOpacityAnimation(from model: any DropShadowModel, context: LayerAnimationContext) throws { guard let opacityKeyframes = model._opacity else { return } try addAnimation( @@ -111,7 +111,7 @@ extension CALayer { context: context) } - private func addShadowColorAnimation(from model: DropShadowModel, context: LayerAnimationContext) throws { + private func addShadowColorAnimation(from model: any DropShadowModel, context: LayerAnimationContext) throws { guard let shadowColorKeyframes = model._color else { return } try addAnimation( @@ -121,7 +121,7 @@ extension CALayer { context: context) } - private func addShadowRadiusAnimation(from model: DropShadowModel, context: LayerAnimationContext) throws { + private func addShadowRadiusAnimation(from model: any DropShadowModel, context: LayerAnimationContext) throws { guard let shadowSizeKeyframes = model._radius else { return } try addAnimation( @@ -131,7 +131,7 @@ extension CALayer { context: context) } - private func addShadowOffsetAnimation(from model: DropShadowModel, context: LayerAnimationContext) throws { + private func addShadowOffsetAnimation(from model: any DropShadowModel, context: LayerAnimationContext) throws { guard let angleKeyframes = model._angle, let distanceKeyframes = model._distance diff --git a/Sources/Private/CoreAnimation/Animations/GradientAnimations.swift b/Sources/Private/CoreAnimation/Animations/GradientAnimations.swift index 17ebf274d0..e672080945 100644 --- a/Sources/Private/CoreAnimation/Animations/GradientAnimations.swift +++ b/Sources/Private/CoreAnimation/Animations/GradientAnimations.swift @@ -32,7 +32,7 @@ extension GradientRenderLayer { /// - The RGB components and alpha components can have different color stops / locations, /// so have to be rendered in separate `CAGradientLayer`s. func addGradientAnimations( - for gradient: GradientShapeItem, + for gradient: any GradientShapeItem, type: GradientContentType, context: LayerAnimationContext) throws @@ -86,7 +86,7 @@ extension GradientRenderLayer { // MARK: Private private func addLinearGradientAnimations( - for gradient: GradientShapeItem, + for gradient: any GradientShapeItem, context: LayerAnimationContext) throws { @@ -109,7 +109,7 @@ extension GradientRenderLayer { context: context) } - private func addRadialGradientAnimations(for gradient: GradientShapeItem, context: LayerAnimationContext) throws { + private func addRadialGradientAnimations(for gradient: any GradientShapeItem, context: LayerAnimationContext) throws { type = .radial let combinedKeyframes = Keyframes.combined( diff --git a/Sources/Private/CoreAnimation/Animations/LayerProperty.swift b/Sources/Private/CoreAnimation/Animations/LayerProperty.swift index b3fd3ad1bc..b185d67bd9 100644 --- a/Sources/Private/CoreAnimation/Animations/LayerProperty.swift +++ b/Sources/Private/CoreAnimation/Animations/LayerProperty.swift @@ -65,7 +65,7 @@ struct CustomizableProperty { /// - `value` is the value for the current frame that should be converted, /// as returned by `AnyValueProvider.typeErasedStorage`. /// - `valueProvider` is the `AnyValueProvider` that returned the type-erased value. - let conversion: (_ value: Any, _ valueProvider: AnyValueProvider) -> ValueRepresentation? + let conversion: (_ value: Any, _ valueProvider: any AnyValueProvider) -> ValueRepresentation? } // MARK: - PropertyName diff --git a/Sources/Private/CoreAnimation/Animations/OpacityAnimation.swift b/Sources/Private/CoreAnimation/Animations/OpacityAnimation.swift index b7bf2200eb..3d0cf443bb 100644 --- a/Sources/Private/CoreAnimation/Animations/OpacityAnimation.swift +++ b/Sources/Private/CoreAnimation/Animations/OpacityAnimation.swift @@ -37,7 +37,7 @@ extension GradientStroke: OpacityAnimationModel { } extension CALayer { /// Adds the opacity animation from the given `OpacityAnimationModel` to this layer @nonobjc - func addOpacityAnimation(for opacity: OpacityAnimationModel, context: LayerAnimationContext) throws { + func addOpacityAnimation(for opacity: any OpacityAnimationModel, context: LayerAnimationContext) throws { try addAnimation( for: .opacity, keyframes: opacity.opacity, diff --git a/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift b/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift index 92b5e4a18b..45c48676c8 100644 --- a/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift +++ b/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift @@ -13,7 +13,7 @@ protocol StrokeShapeItem: ShapeItem, OpacityAnimationModel { var lineJoin: LineJoin { get } var miterLimit: Double { get } var dashPattern: [DashElement]? { get } - func copy(width: KeyframeGroup) -> StrokeShapeItem + func copy(width: KeyframeGroup) -> any StrokeShapeItem } // MARK: - Stroke + StrokeShapeItem @@ -21,7 +21,7 @@ protocol StrokeShapeItem: ShapeItem, OpacityAnimationModel { extension Stroke: StrokeShapeItem { var strokeColor: KeyframeGroup? { color } - func copy(width: KeyframeGroup) -> StrokeShapeItem { + func copy(width: KeyframeGroup) -> any StrokeShapeItem { // Type-erase the copy from `Stroke` to `StrokeShapeItem` let copy: Stroke = copy(width: width) return copy @@ -33,7 +33,7 @@ extension Stroke: StrokeShapeItem { extension GradientStroke: StrokeShapeItem { var strokeColor: KeyframeGroup? { nil } - func copy(width: KeyframeGroup) -> StrokeShapeItem { + func copy(width: KeyframeGroup) -> any StrokeShapeItem { // Type-erase the copy from `GradientStroke` to `StrokeShapeItem` let copy: GradientStroke = copy(width: width) return copy @@ -45,7 +45,7 @@ extension GradientStroke: StrokeShapeItem { extension CAShapeLayer { /// Adds animations for properties related to the given `Stroke` object (`strokeColor`, `lineWidth`, etc) @nonobjc - func addStrokeAnimations(for stroke: StrokeShapeItem, context: LayerAnimationContext) throws { + func addStrokeAnimations(for stroke: any StrokeShapeItem, context: LayerAnimationContext) throws { lineJoin = stroke.lineJoin.caLineJoin lineCap = stroke.lineCap.caLineCap miterLimit = CGFloat(stroke.miterLimit) diff --git a/Sources/Private/CoreAnimation/Animations/TransformAnimations.swift b/Sources/Private/CoreAnimation/Animations/TransformAnimations.swift index 806ff135d5..827e5e0556 100644 --- a/Sources/Private/CoreAnimation/Animations/TransformAnimations.swift +++ b/Sources/Private/CoreAnimation/Animations/TransformAnimations.swift @@ -72,7 +72,7 @@ extension CALayer { /// since child layers don't inherit the `opacity` of their parent. @nonobjc func addTransformAnimations( - for transformModel: TransformModel, + for transformModel: any TransformModel, context: LayerAnimationContext) throws { @@ -102,7 +102,7 @@ extension CALayer { @nonobjc private func addPositionAnimations( - from transformModel: TransformModel, + from transformModel: any TransformModel, context: LayerAnimationContext) throws { @@ -136,7 +136,7 @@ extension CALayer { @nonobjc private func addAnchorPointAnimation( - from transformModel: TransformModel, + from transformModel: any TransformModel, context: LayerAnimationContext) throws { @@ -161,7 +161,7 @@ extension CALayer { @nonobjc private func addScaleAnimations( - from transformModel: TransformModel, + from transformModel: any TransformModel, context: LayerAnimationContext) throws { @@ -189,7 +189,7 @@ extension CALayer { } private func addRotationAnimations( - from transformModel: TransformModel, + from transformModel: any TransformModel, context: LayerAnimationContext) throws { @@ -249,7 +249,7 @@ extension CALayer { /// This is more expensive that animating each component separately, since /// it may require manually interpolating the keyframes at each frame. private func addCombinedTransformAnimation( - for transformModel: TransformModel, + for transformModel: any TransformModel, context: LayerAnimationContext) throws { diff --git a/Sources/Private/CoreAnimation/CoreAnimationLayer.swift b/Sources/Private/CoreAnimation/CoreAnimationLayer.swift index 594368dc51..98547a45d9 100644 --- a/Sources/Private/CoreAnimation/CoreAnimationLayer.swift +++ b/Sources/Private/CoreAnimation/CoreAnimationLayer.swift @@ -15,9 +15,9 @@ final class CoreAnimationLayer: BaseAnimationLayer { /// `CompatibilityTracker.Mode.abort`. init( animation: LottieAnimation, - imageProvider: AnimationImageProvider, - textProvider: AnimationKeypathTextProvider, - fontProvider: AnimationFontProvider, + imageProvider: any AnimationImageProvider, + textProvider: any AnimationKeypathTextProvider, + fontProvider: any AnimationFontProvider, maskAnimationToBounds: Bool, compatibilityTrackerMode: CompatibilityTracker.Mode, logger: LottieLogger) @@ -103,13 +103,13 @@ final class CoreAnimationLayer: BaseAnimationLayer { /// The `AnimationImageProvider` that `ImageLayer`s use to retrieve images, /// referenced by name in the animation json. - var imageProvider: AnimationImageProvider { + var imageProvider: any AnimationImageProvider { didSet { reloadImages() } } /// The `AnimationKeypathTextProvider` that `TextLayer`'s use to retrieve texts, /// that they should use to render their text context - var textProvider: AnimationKeypathTextProvider { + var textProvider: any AnimationKeypathTextProvider { didSet { // We need to rebuild the current animation after updating the text provider, // since this is used in `TextLayer.setupAnimations(context:)` @@ -119,7 +119,7 @@ final class CoreAnimationLayer: BaseAnimationLayer { /// The `FontProvider` that `TextLayer`s use to retrieve the `CTFont` /// that they should use to render their text content - var fontProvider: AnimationFontProvider { + var fontProvider: any AnimationFontProvider { didSet { reloadFonts() } } @@ -286,7 +286,7 @@ final class CoreAnimationLayer: BaseAnimationLayer { // Set up the new animations with the current `TimingConfiguration` for animationLayer in sublayers ?? [] { - try (animationLayer as? AnimationLayer)?.setupAnimations(context: layerContext) + try (animationLayer as? (any AnimationLayer))?.setupAnimations(context: layerContext) } } @@ -431,7 +431,7 @@ extension CoreAnimationLayer: RootAnimationLayer { } var _animationLayers: [CALayer] { - (sublayers ?? []).filter { $0 is AnimationLayer } + (sublayers ?? []).filter { $0 is any AnimationLayer } } func reloadImages() { @@ -487,7 +487,7 @@ extension CoreAnimationLayer: RootAnimationLayer { return allAnimationKeypaths } - func setValueProvider(_ valueProvider: AnyValueProvider, keypath: AnimationKeypath) { + func setValueProvider(_ valueProvider: any AnyValueProvider, keypath: AnimationKeypath) { valueProviderStore.setValueProvider(valueProvider, keypath: keypath) // We need to rebuild the current animation after registering a value provider, @@ -516,7 +516,7 @@ extension CoreAnimationLayer: RootAnimationLayer { return nil } - func animatorNodes(for _: AnimationKeypath) -> [AnimatorNode]? { + func animatorNodes(for _: AnimationKeypath) -> [any AnimatorNode]? { logger.assertionFailure(""" The Core Animation rendering engine does not use `AnimatorNode`s """) diff --git a/Sources/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift b/Sources/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift index fe9e9e0268..e108be01e6 100644 --- a/Sources/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +++ b/Sources/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift @@ -12,7 +12,7 @@ extension CALayer { func fillBoundsOfSuperlayer() { guard let superlayer else { return } - if let customLayerLayer = self as? CustomLayoutLayer { + if let customLayerLayer = self as? any CustomLayoutLayer { customLayerLayer.layout(superlayerBounds: superlayer.bounds) } diff --git a/Sources/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift b/Sources/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift index 627d742936..ee5b247f98 100644 --- a/Sources/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +++ b/Sources/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift @@ -10,7 +10,7 @@ extension KeyframeGroup { /// support animating a given property (e.g. if Core Animation itself doesn't /// support the property). func exactlyOneKeyframe( - context: CompatibilityTrackerProviding, + context: any CompatibilityTrackerProviding, description: String, fileID _: StaticString = #fileID, line _: UInt = #line) diff --git a/Sources/Private/CoreAnimation/Extensions/Keyframes+combined.swift b/Sources/Private/CoreAnimation/Extensions/Keyframes+combined.swift index 5b70c512a7..d3e78d5513 100644 --- a/Sources/Private/CoreAnimation/Extensions/Keyframes+combined.swift +++ b/Sources/Private/CoreAnimation/Extensions/Keyframes+combined.swift @@ -201,7 +201,7 @@ enum Keyframes { /// `requiresManualInterpolation` determines whether the keyframes must be computed using `Keyframes.manuallyInterpolated`, /// which interpolates the value at each frame, or if the keyframes can simply be combined. private static func combined( - _ allGroups: [AnyKeyframeGroup], + _ allGroups: [any AnyKeyframeGroup], requiresManualInterpolation: Bool, makeCombinedResult: ([Any]) throws -> CombinedResult?) rethrows @@ -244,7 +244,7 @@ enum Keyframes { } private static func manuallyInterpolated( - _ allGroups: [AnyKeyframeGroup], + _ allGroups: [any AnyKeyframeGroup], makeCombinedResult: ([Any]) throws -> CombinedResult?) rethrows -> KeyframeGroup diff --git a/Sources/Private/CoreAnimation/Layers/AnimationLayer.swift b/Sources/Private/CoreAnimation/Layers/AnimationLayer.swift index dfd10b58af..57540314f6 100644 --- a/Sources/Private/CoreAnimation/Layers/AnimationLayer.swift +++ b/Sources/Private/CoreAnimation/Layers/AnimationLayer.swift @@ -45,7 +45,7 @@ struct LayerAnimationContext { var currentKeypath: AnimationKeypath /// The `AnimationKeypathTextProvider` - var textProvider: AnimationKeypathTextProvider + var textProvider: any AnimationKeypathTextProvider /// Records the given animation keypath so it can be logged or collected into a list /// - Used for `CoreAnimationLayer.logHierarchyKeypaths()` and `allHierarchyKeypaths()` diff --git a/Sources/Private/CoreAnimation/Layers/BaseAnimationLayer.swift b/Sources/Private/CoreAnimation/Layers/BaseAnimationLayer.swift index 06248b20f8..ec8a79f480 100644 --- a/Sources/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +++ b/Sources/Private/CoreAnimation/Layers/BaseAnimationLayer.swift @@ -19,7 +19,7 @@ class BaseAnimationLayer: CALayer, AnimationLayer { func setupAnimations(context: LayerAnimationContext) throws { for childAnimationLayer in managedSublayers { - try (childAnimationLayer as? AnimationLayer)?.setupAnimations(context: context) + try (childAnimationLayer as? any AnimationLayer)?.setupAnimations(context: context) } } diff --git a/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift b/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift index 976580338e..fa20705700 100644 --- a/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +++ b/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift @@ -71,8 +71,8 @@ class BaseCompositionLayer: BaseAnimationLayer { // There are two different drop shadow schemas, either using `DropShadowEffect` or `DropShadowStyle`. // If both happen to be present, prefer the `DropShadowEffect` (which is the drop shadow schema // supported on other platforms). - let dropShadowEffect = baseLayerModel.effects.first(where: { $0 is DropShadowEffect }) as? DropShadowModel - let dropShadowStyle = baseLayerModel.styles.first(where: { $0 is DropShadowStyle }) as? DropShadowModel + let dropShadowEffect = baseLayerModel.effects.first(where: { $0 is DropShadowEffect }) as? any DropShadowModel + let dropShadowStyle = baseLayerModel.styles.first(where: { $0 is DropShadowStyle }) as? any DropShadowModel if let dropShadowModel = dropShadowEffect ?? dropShadowStyle { try contentsLayer.addDropShadowAnimations(for: dropShadowModel, context: context) } diff --git a/Sources/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift b/Sources/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift index 0ca9339049..af0200c004 100644 --- a/Sources/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +++ b/Sources/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift @@ -6,9 +6,9 @@ /// Context available when constructing an `AnimationLayer` struct LayerContext { let animation: LottieAnimation - let imageProvider: AnimationImageProvider - let textProvider: AnimationKeypathTextProvider - let fontProvider: AnimationFontProvider + let imageProvider: any AnimationImageProvider + let textProvider: any AnimationKeypathTextProvider + let fontProvider: any AnimationFontProvider let compatibilityTracker: CompatibilityTracker var layerName: String diff --git a/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift b/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift index 6a38808af9..47078a2b71 100644 --- a/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift +++ b/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift @@ -350,7 +350,7 @@ extension ShapeItem { !drawsCGPath, // Stroke widths are affected by scaling, but fill colors aren't. // We can expand this to other types of items in the future if necessary. - let stroke = self as? StrokeShapeItem, + let stroke = self as? any StrokeShapeItem, // We only need to handle scaling if there's a `ShapeTransform` present let transform = childGroup.items.first(where: { $0 is ShapeTransform }) as? ShapeTransform else { return self } @@ -517,8 +517,8 @@ extension [ShapeItemLayer.Item] { // when the items have the same `alpha` animations. let allAlphaAnimationsAreIdentical = { strokesAndFills.allSatisfy { item in - (item.item as? OpacityAnimationModel)?.opacity - == (strokesAndFills.first?.item as? OpacityAnimationModel)?.opacity + (item.item as? any OpacityAnimationModel)?.opacity + == (strokesAndFills.first?.item as? any OpacityAnimationModel)?.opacity } } diff --git a/Sources/Private/CoreAnimation/Layers/TextLayer.swift b/Sources/Private/CoreAnimation/Layers/TextLayer.swift index 48b7709620..3ab5731a6a 100644 --- a/Sources/Private/CoreAnimation/Layers/TextLayer.swift +++ b/Sources/Private/CoreAnimation/Layers/TextLayer.swift @@ -50,7 +50,7 @@ final class TextLayer: BaseCompositionLayer { // instead if implemented. if let keypathTextValue = context.textProvider.text(for: textAnimationContext.currentKeypath, sourceText: sourceText.text) { renderLayer.text = keypathTextValue - } else if let legacyTextProvider = context.textProvider as? LegacyAnimationTextProvider { + } else if let legacyTextProvider = context.textProvider as? any LegacyAnimationTextProvider { renderLayer.text = legacyTextProvider.textFor( keypathName: textAnimationContext.currentKeypath.fullPath, sourceText: sourceText.text) diff --git a/Sources/Private/CoreAnimation/ValueProviderStore.swift b/Sources/Private/CoreAnimation/ValueProviderStore.swift index 76934114bc..1981781d2b 100644 --- a/Sources/Private/CoreAnimation/ValueProviderStore.swift +++ b/Sources/Private/CoreAnimation/ValueProviderStore.swift @@ -18,7 +18,7 @@ final class ValueProviderStore { // MARK: Internal /// Registers an `AnyValueProvider` for the given `AnimationKeypath` - func setValueProvider(_ valueProvider: AnyValueProvider, keypath: AnimationKeypath) { + func setValueProvider(_ valueProvider: any AnyValueProvider, keypath: AnimationKeypath) { logger.assert( valueProvider.typeErasedStorage.isSupportedByCoreAnimationRenderingEngine, """ @@ -96,10 +96,10 @@ final class ValueProviderStore { // MARK: Private private let logger: LottieLogger - private var valueProviders = [(keypath: AnimationKeypath, valueProvider: AnyValueProvider)]() + private var valueProviders = [(keypath: AnimationKeypath, valueProvider: any AnyValueProvider)]() /// Retrieves the most-recently-registered Value Provider that matches the given keypath. - private func valueProvider(for keypath: AnimationKeypath) -> AnyValueProvider? { + private func valueProvider(for keypath: AnimationKeypath) -> (any AnyValueProvider)? { // Find the last keypath matching the given keypath, // so we return the value provider that was registered most-recently valueProviders.last(where: { registeredKeypath, _ in diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift index 4cb0b2d2cd..f9aff27837 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift @@ -11,7 +11,7 @@ protocol Diffable { /// /// - Parameters: /// - otherDiffableItem: The other item to check equality against while diffing. - func isDiffableItemEqual(to otherDiffableItem: Diffable) -> Bool + func isDiffableItemEqual(to otherDiffableItem: any Diffable) -> Bool /// The identifier to use when checking identity while diffing. var diffIdentifier: AnyHashable { get } diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift index e6377cba7d..b5412f1571 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift @@ -84,5 +84,5 @@ private struct PropertyStorage { var value: Any /// The property's corresponding `EpoxyModelProperty`, erased to an `AnyEpoxyModelProperty`. - var property: AnyEpoxyModelProperty + var property: any AnyEpoxyModelProperty } diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift index 98e6787d5d..915ba3be56 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift @@ -46,7 +46,7 @@ extension EpoxyModeled { /// Returns a copy of this model produced by merging the given `other` model's storage into this /// model's storage. - func merging(_ other: EpoxyModeled) -> Self { + func merging(_ other: any EpoxyModeled) -> Self { var copy = self copy.storage.merge(other.storage) return copy diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift index bf82156db7..bebec48e0b 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift @@ -39,7 +39,7 @@ extension EpoxyModeled where Self: DataIDProviding { private var dataIDProperty: EpoxyModelProperty { EpoxyModelProperty( - keyPath: \DataIDProviding.dataID, + keyPath: \(any DataIDProviding).dataID, defaultValue: DefaultDataID.noneProvided, updateStrategy: .replace) } diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift index 8242de12d4..bdb7f1f8b5 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift @@ -30,7 +30,7 @@ extension EpoxyModeled where Self: StyleIDProviding { private var styleIDProperty: EpoxyModelProperty { .init( - keyPath: \StyleIDProviding.styleID, + keyPath: \(any StyleIDProviding).styleID, defaultValue: nil, updateStrategy: .replace) } diff --git a/Sources/Private/EmbeddedLibraries/ZipFoundation/Entry.swift b/Sources/Private/EmbeddedLibraries/ZipFoundation/Entry.swift index c152192585..03b00977a8 100644 --- a/Sources/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +++ b/Sources/Private/EmbeddedLibraries/ZipFoundation/Entry.swift @@ -80,7 +80,7 @@ struct Entry: Equatable { static let size = 30 let fileNameData: Data let extraFieldData: Data - var extraFields: [ExtensibleDataField]? + var extraFields: [any ExtensibleDataField]? } struct DataDescriptor: DataSerializable { @@ -122,7 +122,7 @@ struct Entry: Equatable { let extraFieldData: Data let fileCommentData: Data - var extraFields: [ExtensibleDataField]? + var extraFields: [any ExtensibleDataField]? var usesDataDescriptor: Bool { (generalPurposeBitFlag & (1 << 3)) != 0 } var usesUTF8PathEncoding: Bool { (generalPurposeBitFlag & (1 << 11)) != 0 } diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift index 41ad736496..1760c17d3b 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift @@ -62,8 +62,8 @@ class CompositionLayer: CALayer, KeypathSearchable { // There are two different drop shadow schemas, either using `DropShadowEffect` or `DropShadowStyle`. // If both happen to be present, prefer the `DropShadowEffect` (which is the drop shadow schema // supported on other platforms). - let dropShadowEffect = layer.effects.first(where: { $0 is DropShadowEffect }) as? DropShadowModel - let dropShadowStyle = layer.styles.first(where: { $0 is DropShadowStyle }) as? DropShadowModel + let dropShadowEffect = layer.effects.first(where: { $0 is DropShadowEffect }) as? any DropShadowModel + let dropShadowStyle = layer.styles.first(where: { $0 is DropShadowStyle }) as? any DropShadowModel if let dropShadowModel = dropShadowEffect ?? dropShadowStyle { layerEffectNodes.append(DropShadowNode(model: dropShadowModel)) } @@ -94,7 +94,7 @@ class CompositionLayer: CALayer, KeypathSearchable { // MARK: Internal - weak var layerDelegate: CompositionLayerDelegate? + weak var layerDelegate: (any CompositionLayerDelegate)? let transformNode: LayerTransformNode @@ -109,13 +109,13 @@ class CompositionLayer: CALayer, KeypathSearchable { let startFrame: CGFloat let timeStretch: CGFloat - var layerEffectNodes: [LayerEffectNode] = [] + var layerEffectNodes: [any LayerEffectNode] = [] // MARK: Keypath Searchable let keypathName: String - final var childKeypaths: [KeypathSearchable] + final var childKeypaths: [any KeypathSearchable] var renderScale: CGFloat = 1 { didSet { @@ -137,7 +137,7 @@ class CompositionLayer: CALayer, KeypathSearchable { } } - var keypathProperties: [String: AnyNodeProperty] { + var keypathProperties: [String: any AnyNodeProperty] { [:] } diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift index bfab6ea50c..579a8b8487 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift @@ -177,9 +177,9 @@ private class MaskNodeProperties: NodePropertyMap { // MARK: Internal - var propertyMap: [String: AnyNodeProperty] + var propertyMap: [String: any AnyNodeProperty] - var properties: [AnyNodeProperty] + var properties: [any AnyNodeProperty] let mode: MaskMode let inverted: Bool diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift index 44d6a394fb..4e0a504b9c 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift @@ -17,8 +17,8 @@ final class PreCompositionLayer: CompositionLayer { layerImageProvider: LayerImageProvider, layerTextProvider: LayerTextProvider, layerFontProvider: LayerFontProvider, - textProvider: AnimationKeypathTextProvider, - fontProvider: AnimationFontProvider, + textProvider: any AnimationKeypathTextProvider, + fontProvider: any AnimationFontProvider, assetLibrary: AssetLibrary?, frameRate: CGFloat, rootAnimationLayer: MainThreadAnimationLayer?) @@ -103,7 +103,7 @@ final class PreCompositionLayer: CompositionLayer { let frameRate: CGFloat let remappingNode: NodeProperty? - override var keypathProperties: [String: AnyNodeProperty] { + override var keypathProperties: [String: any AnyNodeProperty] { guard let remappingNode else { return super.keypathProperties } diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift index a10189f229..73a73174b2 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift @@ -42,7 +42,7 @@ final class ShapeCompositionLayer: CompositionLayer { // MARK: Internal - let rootNode: AnimatorNode? + let rootNode: (any AnimatorNode)? let renderContainer: ShapeContainerLayer? override func displayContentsWithFrame(frame: CGFloat, forceUpdates: Bool) { diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift index 7902770b56..bfb235616d 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift @@ -43,7 +43,7 @@ final class SolidCompositionLayer: CompositionLayer { let colorProperty: NodeProperty? let solidShape = CAShapeLayer() - override var keypathProperties: [String: AnyNodeProperty] { + override var keypathProperties: [String: any AnyNodeProperty] { guard let colorProperty else { return super.keypathProperties } return [PropertyName.color.rawValue : colorProperty] } diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift index 059d17d4e2..4697fc9cb2 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift @@ -44,8 +44,8 @@ final class TextCompositionLayer: CompositionLayer { init( textLayer: TextLayerModel, - textProvider: AnimationKeypathTextProvider, - fontProvider: AnimationFontProvider, + textProvider: any AnimationKeypathTextProvider, + fontProvider: any AnimationFontProvider, rootAnimationLayer: MainThreadAnimationLayer?) { var rootNode: TextAnimatorNode? @@ -93,8 +93,8 @@ final class TextCompositionLayer: CompositionLayer { let textDocument: KeyframeInterpolator? let textLayer = CoreTextRenderLayer() - var textProvider: AnimationKeypathTextProvider - var fontProvider: AnimationFontProvider + var textProvider: any AnimationKeypathTextProvider + var fontProvider: any AnimationFontProvider weak var rootAnimationLayer: MainThreadAnimationLayer? lazy var fullAnimationKeypath: AnimationKeypath = // Individual layers don't know their full keypaths, so we have to delegate @@ -124,7 +124,7 @@ final class TextCompositionLayer: CompositionLayer { let textString: String = if let keypathTextValue = textProvider.text(for: fullAnimationKeypath, sourceText: text.text) { keypathTextValue - } else if let legacyTextProvider = textProvider as? LegacyAnimationTextProvider { + } else if let legacyTextProvider = textProvider as? any LegacyAnimationTextProvider { legacyTextProvider.textFor(keypathName: keypathName, sourceText: text.text) } else { text.text diff --git a/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift b/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift index 14e45a6fe4..7fe98326e7 100644 --- a/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift @@ -19,9 +19,9 @@ final class MainThreadAnimationLayer: CALayer, RootAnimationLayer { init( animation: LottieAnimation, - imageProvider: AnimationImageProvider, - textProvider: AnimationKeypathTextProvider, - fontProvider: AnimationFontProvider, + imageProvider: any AnimationImageProvider, + textProvider: any AnimationKeypathTextProvider, + fontProvider: any AnimationFontProvider, maskAnimationToBounds: Bool, logger: LottieLogger) { @@ -116,7 +116,7 @@ final class MainThreadAnimationLayer: CALayer, RootAnimationLayer { return super.needsDisplay(forKey: key) } - override public func action(forKey event: String) -> CAAction? { + override public func action(forKey event: String) -> (any CAAction)? { if event == "currentFrame" { let animation = CABasicAnimation(keyPath: event) animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) @@ -176,7 +176,7 @@ final class MainThreadAnimationLayer: CALayer, RootAnimationLayer { Array(animationLayers) } - var imageProvider: AnimationImageProvider { + var imageProvider: any AnimationImageProvider { get { layerImageProvider.imageProvider } @@ -193,12 +193,12 @@ final class MainThreadAnimationLayer: CALayer, RootAnimationLayer { } } - var textProvider: AnimationKeypathTextProvider { + var textProvider: any AnimationKeypathTextProvider { get { layerTextProvider.textProvider } set { layerTextProvider.textProvider = newValue } } - var fontProvider: AnimationFontProvider { + var fontProvider: any AnimationFontProvider { get { layerFontProvider.fontProvider } set { layerFontProvider.fontProvider = newValue } } @@ -230,7 +230,7 @@ final class MainThreadAnimationLayer: CALayer, RootAnimationLayer { animationLayers.flatMap { $0.allKeypaths() } } - func setValueProvider(_ valueProvider: AnyValueProvider, keypath: AnimationKeypath) { + func setValueProvider(_ valueProvider: any AnyValueProvider, keypath: AnimationKeypath) { for layer in animationLayers { if let foundProperties = layer.nodeProperties(for: keypath) { for property in foundProperties { @@ -283,8 +283,8 @@ final class MainThreadAnimationLayer: CALayer, RootAnimationLayer { return nil } - func animatorNodes(for keypath: AnimationKeypath) -> [AnimatorNode]? { - var results = [AnimatorNode]() + func animatorNodes(for keypath: AnimationKeypath) -> [any AnimatorNode]? { + var results = [any AnimatorNode]() for layer in animationLayers { if let nodes = layer.animatorNodes(for: keypath) { results.append(contentsOf: nodes) diff --git a/Sources/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift b/Sources/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift index 068f3aa795..79962db1cc 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift @@ -13,7 +13,7 @@ private final class CachedImageProvider: AnimationImageProvider { /// /// - Parameter imageProvider: The provider to load image from asset /// - public init(imageProvider: AnimationImageProvider) { + public init(imageProvider: any AnimationImageProvider) { self.imageProvider = imageProvider } @@ -43,7 +43,7 @@ private final class CachedImageProvider: AnimationImageProvider { /// clears all cached values when the app is backgrounded instead of /// only when the app receives a memory warning notification. private var imageCache = LRUCache() - private let imageProvider: AnimationImageProvider + private let imageProvider: any AnimationImageProvider } @@ -51,7 +51,7 @@ extension AnimationImageProvider { /// Create a cache enabled image provider which will reuse the asset image with the same asset id /// It wraps the current provider as image loader, and uses `NSCache` to cache the images for resue. /// The cache will be reset when the `animation` is reset. - var cachedImageProvider: AnimationImageProvider { + var cachedImageProvider: any AnimationImageProvider { guard cacheEligible else { return self } return CachedImageProvider(imageProvider: self) } diff --git a/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift b/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift index 9311603023..c7ce55f67a 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift @@ -15,8 +15,8 @@ extension [LayerModel] { layerImageProvider: LayerImageProvider, layerTextProvider: LayerTextProvider, layerFontProvider: LayerFontProvider, - textProvider: AnimationKeypathTextProvider, - fontProvider: AnimationFontProvider, + textProvider: any AnimationKeypathTextProvider, + fontProvider: any AnimationFontProvider, frameRate: CGFloat, rootAnimationLayer: MainThreadAnimationLayer?) -> [CompositionLayer] diff --git a/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift b/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift index 5d72f5cfa9..417d612e88 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift @@ -146,7 +146,7 @@ final class CoreTextRenderLayer: CALayer { // MARK: Internal - override func action(forKey _: String) -> CAAction? { + override func action(forKey _: String) -> (any CAAction)? { nil } diff --git a/Sources/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift b/Sources/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift index e054ce254f..ef21a2947b 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift @@ -11,7 +11,7 @@ final class LayerFontProvider { // MARK: Lifecycle - init(fontProvider: AnimationFontProvider) { + init(fontProvider: any AnimationFontProvider) { self.fontProvider = fontProvider textLayers = [] reloadTexts() @@ -21,7 +21,7 @@ final class LayerFontProvider { private(set) var textLayers: [TextCompositionLayer] - var fontProvider: AnimationFontProvider { + var fontProvider: any AnimationFontProvider { didSet { reloadTexts() } diff --git a/Sources/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift b/Sources/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift index db531f85c0..667691a8e6 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift @@ -10,7 +10,7 @@ final class LayerImageProvider { // MARK: Lifecycle - init(imageProvider: AnimationImageProvider, assets: [String: ImageAsset]?) { + init(imageProvider: any AnimationImageProvider, assets: [String: ImageAsset]?) { self.imageProvider = imageProvider imageLayers = [ImageCompositionLayer]() if let assets { @@ -26,7 +26,7 @@ final class LayerImageProvider { private(set) var imageLayers: [ImageCompositionLayer] let imageAssets: [String: ImageAsset] - var imageProvider: AnimationImageProvider { + var imageProvider: any AnimationImageProvider { didSet { reloadImages() } diff --git a/Sources/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift b/Sources/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift index 365ab26ab1..d27989bf46 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift @@ -10,7 +10,7 @@ final class LayerTextProvider { // MARK: Lifecycle - init(textProvider: AnimationKeypathTextProvider) { + init(textProvider: any AnimationKeypathTextProvider) { self.textProvider = textProvider textLayers = [] reloadTexts() @@ -20,7 +20,7 @@ final class LayerTextProvider { private(set) var textLayers: [TextCompositionLayer] - var textProvider: AnimationKeypathTextProvider { + var textProvider: any AnimationKeypathTextProvider { didSet { reloadTexts() } diff --git a/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift b/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift index fc5d2dae90..a4adb13e38 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift @@ -21,7 +21,7 @@ final class LayerTransformProperties: NodePropertyMap, KeypathSearchable { rotationZ = NodeProperty(provider: KeyframeInterpolator(keyframes: transform.rotationZ.keyframes)) opacity = NodeProperty(provider: KeyframeInterpolator(keyframes: transform.opacity.keyframes)) - var propertyMap: [String: AnyNodeProperty] = [ + var propertyMap: [String: any AnyNodeProperty] = [ "Anchor Point" : anchor, PropertyName.scale.rawValue : scale, PropertyName.rotation.rawValue: rotationZ, @@ -60,10 +60,10 @@ final class LayerTransformProperties: NodePropertyMap, KeypathSearchable { // MARK: Internal - let keypathProperties: [String: AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] var keypathName = "Transform" - let properties: [AnyNodeProperty] + let properties: [any AnyNodeProperty] let anchor: NodeProperty let scale: NodeProperty @@ -75,7 +75,7 @@ final class LayerTransformProperties: NodePropertyMap, KeypathSearchable { let positionY: NodeProperty? let opacity: NodeProperty - var childKeypaths: [KeypathSearchable] { + var childKeypaths: [any KeypathSearchable] { [] } } @@ -92,11 +92,11 @@ class LayerTransformNode: AnimatorNode { // MARK: Internal - let outputNode: NodeOutput = PassThroughOutputNode(parent: nil) + let outputNode: any NodeOutput = PassThroughOutputNode(parent: nil) let transformProperties: LayerTransformProperties - var parentNode: AnimatorNode? + var parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil @@ -108,7 +108,7 @@ class LayerTransformNode: AnimatorNode { // MARK: Animator Node Protocol - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { transformProperties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift b/Sources/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift index 53b9d3a770..ebeef56b91 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift @@ -8,11 +8,11 @@ // MARK: - NodeTree final class NodeTree { - var rootNode: AnimatorNode? = nil + var rootNode: (any AnimatorNode)? = nil var transform: ShapeTransform? = nil var renderContainers: [ShapeContainerLayer] = [] var paths: [PathOutputNode] = [] - var childrenNodes: [AnimatorNode] = [] + var childrenNodes: [any AnimatorNode] = [] } extension [ShapeItem] { @@ -93,12 +93,12 @@ extension [ShapeItem] { """) } - if let pathNode = nodeTree.rootNode as? PathNode { + if let pathNode = nodeTree.rootNode as? any PathNode { //// Add path container to the node tree nodeTree.paths.append(pathNode.pathOutput) } - if let renderNode = nodeTree.rootNode as? RenderNode { + if let renderNode = nodeTree.rootNode as? any RenderNode { nodeTree.renderContainers.append(ShapeRenderLayer(renderer: renderNode.renderer)) } } diff --git a/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift b/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift index 8702f2c59c..4eacdd466a 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift @@ -13,7 +13,7 @@ class NodeProperty: AnyNodeProperty { // MARK: Lifecycle - init(provider: AnyValueProvider) { + init(provider: any AnyValueProvider) { valueProvider = provider originalValueProvider = valueProvider typedContainer = ValueContainer(provider.value(frame: 0) as! T) @@ -22,8 +22,8 @@ class NodeProperty: AnyNodeProperty { // MARK: Internal - var valueProvider: AnyValueProvider - var originalValueProvider: AnyValueProvider + var valueProvider: any AnyValueProvider + var originalValueProvider: any AnyValueProvider var valueType: Any.Type { T.self } @@ -31,7 +31,7 @@ class NodeProperty: AnyNodeProperty { typedContainer.outputValue } - var valueContainer: AnyValueContainer { + var valueContainer: any AnyValueContainer { typedContainer } @@ -39,7 +39,7 @@ class NodeProperty: AnyNodeProperty { valueContainer.needsUpdate || valueProvider.hasUpdate(frame: frame) } - func setProvider(provider: AnyValueProvider) { + func setProvider(provider: any AnyValueProvider) { guard provider.valueType == valueType else { return } valueProvider = provider valueContainer.setNeedsUpdate() diff --git a/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift b/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift index 132d96a894..8a01234747 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift @@ -20,19 +20,19 @@ protocol AnyNodeProperty { func update(frame: CGFloat) /// The stored value container for the property - var valueContainer: AnyValueContainer { get } + var valueContainer: any AnyValueContainer { get } /// The value provider for the property - var valueProvider: AnyValueProvider { get } + var valueProvider: any AnyValueProvider { get } /// The original value provider for the property - var originalValueProvider: AnyValueProvider { get } + var originalValueProvider: any AnyValueProvider { get } /// The Type of the value provider var valueType: Any.Type { get } /// Sets the value provider for the property. - func setProvider(provider: AnyValueProvider) + func setProvider(provider: any AnyValueProvider) } extension AnyNodeProperty { diff --git a/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift b/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift index c91c99aa5b..6d44bf1c3e 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift @@ -14,10 +14,10 @@ protocol KeypathSearchable { var keypathName: String { get } /// A list of properties belonging to the keypath. - var keypathProperties: [String: AnyNodeProperty] { get } + var keypathProperties: [String: any AnyNodeProperty] { get } /// Children Keypaths - var childKeypaths: [KeypathSearchable] { get } + var childKeypaths: [any KeypathSearchable] { get } var keypathLayer: CALayer? { get } } diff --git a/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift b/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift index c3813d7b42..3087b916f1 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift @@ -10,12 +10,12 @@ import QuartzCore // MARK: - NodePropertyMap protocol NodePropertyMap { - var properties: [AnyNodeProperty] { get } + var properties: [any AnyNodeProperty] { get } } extension NodePropertyMap { - var childKeypaths: [KeypathSearchable] { + var childKeypaths: [any KeypathSearchable] { [] } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift index 7434f0acd9..461db73baa 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift @@ -9,7 +9,7 @@ final class DropShadowNode: LayerEffectNode { // MARK: Lifecycle - init(model: DropShadowModel) { + init(model: any DropShadowModel) { properties = DropShadowNodeProperties(model: model) } @@ -55,7 +55,7 @@ final class DropShadowNodeProperties: NodePropertyMap { // MARK: Lifecycle - init(model: DropShadowModel) { + init(model: any DropShadowModel) { if let opacityKeyframes = model._opacity?.keyframes { opacity = NodeProperty(provider: KeyframeInterpolator(keyframes: opacityKeyframes)) propertyMap[PropertyName.opacity.rawValue] = opacity @@ -91,8 +91,8 @@ final class DropShadowNodeProperties: NodePropertyMap { // MARK: Internal - var propertyMap: [String: AnyNodeProperty] = [:] - var properties: [AnyNodeProperty] + var propertyMap: [String: any AnyNodeProperty] = [:] + var properties: [any AnyNodeProperty] let opacity: NodeProperty? let radius: NodeProperty? diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift index 69686cf196..13f15d65bd 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift @@ -7,7 +7,7 @@ import QuartzCore protocol LayerEffectNode { func applyEffect(to layer: CALayer) - var propertyMap: NodePropertyMap { get } + var propertyMap: any NodePropertyMap { get } } extension LayerEffectNode { diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift index 67be54b5cf..c1a24c2d46 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift @@ -23,8 +23,8 @@ final class RoundedCornersProperties: NodePropertyMap, KeypathSearchable { // MARK: Internal - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] let keypathName: String let radius: NodeProperty @@ -36,7 +36,7 @@ final class RoundedCornersNode: AnimatorNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, roundedCorners: RoundedCorners, upstreamPaths: [PathOutputNode]) { + init(parentNode: (any AnimatorNode)?, roundedCorners: RoundedCorners, upstreamPaths: [PathOutputNode]) { outputNode = PassThroughOutputNode(parent: parentNode?.outputNode) self.parentNode = parentNode properties = RoundedCornersProperties(roundedCorners: roundedCorners) @@ -47,15 +47,15 @@ final class RoundedCornersNode: AnimatorNode { let properties: RoundedCornersProperties - let parentNode: AnimatorNode? - let outputNode: NodeOutput + let parentNode: (any AnimatorNode)? + let outputNode: any NodeOutput var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil var isEnabled = true // MARK: Animator Node - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { properties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift index 13000dc332..f287d865c6 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift @@ -30,8 +30,8 @@ final class TrimPathProperties: NodePropertyMap, KeypathSearchable { // MARK: Internal - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] let keypathName: String let start: NodeProperty @@ -46,7 +46,7 @@ final class TrimPathNode: AnimatorNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, trim: Trim, upstreamPaths: [PathOutputNode]) { + init(parentNode: (any AnimatorNode)?, trim: Trim, upstreamPaths: [PathOutputNode]) { outputNode = PassThroughOutputNode(parent: parentNode?.outputNode) self.parentNode = parentNode properties = TrimPathProperties(trim: trim) @@ -57,15 +57,15 @@ final class TrimPathNode: AnimatorNode { let properties: TrimPathProperties - let parentNode: AnimatorNode? - let outputNode: NodeOutput + let parentNode: (any AnimatorNode)? + let outputNode: any NodeOutput var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil var isEnabled = true // MARK: Animator Node - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { properties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift index 6c54d4919a..8977347882 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift @@ -11,15 +11,15 @@ class GroupOutputNode: NodeOutput { // MARK: Lifecycle - init(parent: NodeOutput?, rootNode: NodeOutput?) { + init(parent: (any NodeOutput)?, rootNode: (any NodeOutput)?) { self.parent = parent self.rootNode = rootNode } // MARK: Internal - let parent: NodeOutput? - let rootNode: NodeOutput? + let parent: (any NodeOutput)? + let rootNode: (any NodeOutput)? var isEnabled = true private(set) var outputPath: CGPath? = nil diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift index f044b7ba4b..dc69b18908 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift @@ -11,13 +11,13 @@ class PassThroughOutputNode: NodeOutput { // MARK: Lifecycle - init(parent: NodeOutput?) { + init(parent: (any NodeOutput)?) { self.parent = parent } // MARK: Internal - let parent: NodeOutput? + let parent: (any NodeOutput)? var hasUpdate = false var isEnabled = true diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift index b5c600c205..4bddda886a 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift @@ -12,13 +12,13 @@ class PathOutputNode: NodeOutput { // MARK: Lifecycle - init(parent: NodeOutput?) { + init(parent: (any NodeOutput)?) { self.parent = parent } // MARK: Internal - let parent: NodeOutput? + let parent: (any NodeOutput)? fileprivate(set) var outputPath: CGPath? = nil diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift index d011ad61d3..0eccb5f97a 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift @@ -137,7 +137,7 @@ final class GradientFillRenderer: PassThroughOutputNode, Renderable { // MARK: Lifecycle - override init(parent: NodeOutput?) { + override init(parent: (any NodeOutput)?) { super.init(parent: parent) maskLayer.fillColor = .rgb(1, 1, 1) diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift index 531b2559d2..642a6bcc8c 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift @@ -13,7 +13,7 @@ final class GradientStrokeRenderer: PassThroughOutputNode, Renderable { // MARK: Lifecycle - override init(parent: NodeOutput?) { + override init(parent: (any NodeOutput)?) { strokeRender = StrokeRenderer(parent: nil) gradientRender = LegacyGradientFillRenderer(parent: nil) strokeRender.color = .rgb(1, 1, 1) diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift index a5c40e6b63..f51508f3d0 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift @@ -34,8 +34,8 @@ final class EllipseNodeProperties: NodePropertyMap, KeypathSearchable { let position: NodeProperty let size: NodeProperty - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] } // MARK: - EllipseNode @@ -44,7 +44,7 @@ final class EllipseNode: AnimatorNode, PathNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, ellipse: Ellipse) { + init(parentNode: (any AnimatorNode)?, ellipse: Ellipse) { pathOutput = PathOutputNode(parent: parentNode?.outputNode) properties = EllipseNodeProperties(ellipse: ellipse) self.parentNode = parentNode @@ -58,14 +58,14 @@ final class EllipseNode: AnimatorNode, PathNode { let properties: EllipseNodeProperties - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil // MARK: Animator Node - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { properties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift index 49e502b9c4..3115416e31 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift @@ -36,10 +36,10 @@ final class PolygonNodeProperties: NodePropertyMap, KeypathSearchable { var keypathName: String - var childKeypaths: [KeypathSearchable] = [] + var childKeypaths: [any KeypathSearchable] = [] - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] let direction: PathDirection let position: NodeProperty @@ -55,7 +55,7 @@ final class PolygonNode: AnimatorNode, PathNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, star: Star) { + init(parentNode: (any AnimatorNode)?, star: Star) { pathOutput = PathOutputNode(parent: parentNode?.outputNode) properties = PolygonNodeProperties(star: star) self.parentNode = parentNode @@ -70,14 +70,14 @@ final class PolygonNode: AnimatorNode, PathNode { let pathOutput: PathOutputNode - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil // MARK: Animator Node - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { properties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift index 4c93f002b5..54dabe8d8e 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift @@ -34,8 +34,8 @@ final class RectNodeProperties: NodePropertyMap, KeypathSearchable { var keypathName: String - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] let direction: PathDirection let position: NodeProperty @@ -50,7 +50,7 @@ final class RectangleNode: AnimatorNode, PathNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, rectangle: Rectangle) { + init(parentNode: (any AnimatorNode)?, rectangle: Rectangle) { properties = RectNodeProperties(rectangle: rectangle) pathOutput = PathOutputNode(parent: parentNode?.outputNode) self.parentNode = parentNode @@ -61,14 +61,14 @@ final class RectangleNode: AnimatorNode, PathNode { let properties: RectNodeProperties let pathOutput: PathOutputNode - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil // MARK: Animator Node - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { properties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift index 7bc7d9055d..cbd709ecb7 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift @@ -28,8 +28,8 @@ final class ShapeNodeProperties: NodePropertyMap, KeypathSearchable { var keypathName: String let path: NodeProperty - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] } @@ -39,7 +39,7 @@ final class ShapeNode: AnimatorNode, PathNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, shape: Shape) { + init(parentNode: (any AnimatorNode)?, shape: Shape) { pathOutput = PathOutputNode(parent: parentNode?.outputNode) properties = ShapeNodeProperties(shape: shape) self.parentNode = parentNode @@ -51,13 +51,13 @@ final class ShapeNode: AnimatorNode, PathNode { let pathOutput: PathOutputNode - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil // MARK: Animator Node - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { properties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift index bf1753108f..b0597be9c6 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift @@ -48,8 +48,8 @@ final class StarNodeProperties: NodePropertyMap, KeypathSearchable { var keypathName: String - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] let direction: PathDirection let position: NodeProperty @@ -67,7 +67,7 @@ final class StarNode: AnimatorNode, PathNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, star: Star) { + init(parentNode: (any AnimatorNode)?, star: Star) { pathOutput = PathOutputNode(parent: parentNode?.outputNode) properties = StarNodeProperties(star: star) self.parentNode = parentNode @@ -82,13 +82,13 @@ final class StarNode: AnimatorNode, PathNode { let pathOutput: PathOutputNode - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil // MARK: Animator Node - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { properties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift index ddda7a3cc7..0f6f4d5274 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift @@ -55,10 +55,10 @@ final class GroupNodeProperties: NodePropertyMap, KeypathSearchable { var keypathName = "Transform" - var childKeypaths: [KeypathSearchable] = [] + var childKeypaths: [any KeypathSearchable] = [] - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] let anchor: NodeProperty let position: NodeProperty @@ -91,13 +91,13 @@ final class GroupNode: AnimatorNode { // MARK: Lifecycle // MARK: Initializer - init(name: String, parentNode: AnimatorNode?, tree: NodeTree) { + init(name: String, parentNode: (any AnimatorNode)?, tree: NodeTree) { self.parentNode = parentNode keypathName = name rootNode = tree.rootNode properties = GroupNodeProperties(transform: tree.transform) groupOutput = GroupOutputNode(parent: parentNode?.outputNode, rootNode: rootNode?.outputNode) - var childKeypaths: [KeypathSearchable] = tree.childrenNodes + var childKeypaths: [any KeypathSearchable] = tree.childrenNodes childKeypaths.append(properties) self.childKeypaths = childKeypaths @@ -113,7 +113,7 @@ final class GroupNode: AnimatorNode { let properties: GroupNodeProperties - let rootNode: AnimatorNode? + let rootNode: (any AnimatorNode)? var container = ShapeContainerLayer() @@ -121,9 +121,9 @@ final class GroupNode: AnimatorNode { let keypathName: String - let childKeypaths: [KeypathSearchable] + let childKeypaths: [any KeypathSearchable] - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil @@ -134,11 +134,11 @@ final class GroupNode: AnimatorNode { // MARK: Animator Node Protocol - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { properties } - var outputNode: NodeOutput { + var outputNode: any NodeOutput { groupOutput } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift index 1b079b084a..2e275248e5 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift @@ -34,8 +34,8 @@ final class FillNodeProperties: NodePropertyMap, KeypathSearchable { let color: NodeProperty let type: FillRule - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] } @@ -45,7 +45,7 @@ final class FillNode: AnimatorNode, RenderNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, fill: Fill) { + init(parentNode: (any AnimatorNode)?, fill: Fill) { fillRender = FillRenderer(parent: parentNode?.outputNode) fillProperties = FillNodeProperties(fill: fill) self.parentNode = parentNode @@ -57,18 +57,18 @@ final class FillNode: AnimatorNode, RenderNode { let fillProperties: FillNodeProperties - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil - var renderer: NodeOutput & Renderable { + var renderer: any (NodeOutput & Renderable) { fillRender } // MARK: Animator Node Protocol - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { fillProperties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift index 97e37ef614..c0840668a6 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift @@ -45,8 +45,8 @@ final class GradientFillProperties: NodePropertyMap, KeypathSearchable { let numberOfColors: Int let fillRule: FillRule - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] } @@ -56,7 +56,7 @@ final class GradientFillNode: AnimatorNode, RenderNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, gradientFill: GradientFill) { + init(parentNode: (any AnimatorNode)?, gradientFill: GradientFill) { fillRender = GradientFillRenderer(parent: parentNode?.outputNode) fillProperties = GradientFillProperties(gradientfill: gradientFill) self.parentNode = parentNode @@ -68,18 +68,18 @@ final class GradientFillNode: AnimatorNode, RenderNode { let fillProperties: GradientFillProperties - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil - var renderer: NodeOutput & Renderable { + var renderer: any (NodeOutput & Renderable) { fillRender } // MARK: Animator Node Protocol - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { fillProperties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift index 62f0dfe6c7..8c806a3589 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift @@ -74,8 +74,8 @@ final class GradientStrokeProperties: NodePropertyMap, KeypathSearchable { let gradientType: GradientType let numberOfColors: Int - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] } @@ -85,7 +85,7 @@ final class GradientStrokeNode: AnimatorNode, RenderNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, gradientStroke: GradientStroke) { + init(parentNode: (any AnimatorNode)?, gradientStroke: GradientStroke) { strokeRender = GradientStrokeRenderer(parent: parentNode?.outputNode) strokeProperties = GradientStrokeProperties(gradientStroke: gradientStroke) self.parentNode = parentNode @@ -97,18 +97,18 @@ final class GradientStrokeNode: AnimatorNode, RenderNode { let strokeProperties: GradientStrokeProperties - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil - var renderer: NodeOutput & Renderable { + var renderer: any (NodeOutput & Renderable) { strokeRender } // MARK: Animator Node Protocol - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { strokeProperties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift index ae2aed4818..37a8121f2d 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift @@ -48,8 +48,8 @@ final class StrokeNodeProperties: NodePropertyMap, KeypathSearchable { // MARK: Internal let keypathName: String - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] let opacity: NodeProperty let color: NodeProperty @@ -71,7 +71,7 @@ final class StrokeNode: AnimatorNode, RenderNode { // MARK: Lifecycle - init(parentNode: AnimatorNode?, stroke: Stroke) { + init(parentNode: (any AnimatorNode)?, stroke: Stroke) { strokeRender = StrokeRenderer(parent: parentNode?.outputNode) strokeProperties = StrokeNodeProperties(stroke: stroke) self.parentNode = parentNode @@ -83,18 +83,18 @@ final class StrokeNode: AnimatorNode, RenderNode { let strokeProperties: StrokeNodeProperties - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil - var renderer: NodeOutput & Renderable { + var renderer: any (NodeOutput & Renderable) { strokeRender } // MARK: Animator Node Protocol - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { strokeProperties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift index dd9e0685b0..0400e602be 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift @@ -16,7 +16,7 @@ final class TextAnimatorNodeProperties: NodePropertyMap, KeypathSearchable { init(textAnimator: TextAnimator) { keypathName = textAnimator.name textRangeUnit = textAnimator.textRangeUnit - var properties = [String : AnyNodeProperty]() + var properties = [String : any AnyNodeProperty]() if let keyframeGroup = textAnimator.anchor { anchor = NodeProperty(provider: KeyframeInterpolator(keyframes: keyframeGroup.keyframes)) @@ -158,8 +158,8 @@ final class TextAnimatorNodeProperties: NodePropertyMap, KeypathSearchable { let selectedRangeOpacity: NodeProperty? let textRangeUnit: TextRangeUnit? - let keypathProperties: [String: AnyNodeProperty] - let properties: [AnyNodeProperty] + let keypathProperties: [String: any AnyNodeProperty] + let properties: [any AnyNodeProperty] var caTransform: CATransform3D { CATransform3D.makeTransform( @@ -191,7 +191,7 @@ final class TextOutputNode: NodeOutput { var outputPath: CGPath? - var parent: NodeOutput? { + var parent: (any NodeOutput)? { parentTextNode } @@ -312,19 +312,19 @@ class TextAnimatorNode: AnimatorNode { let textAnimatorProperties: TextAnimatorNodeProperties - let parentNode: AnimatorNode? + let parentNode: (any AnimatorNode)? var hasLocalUpdates = false var hasUpstreamUpdates = false var lastUpdateFrame: CGFloat? = nil var isEnabled = true - var outputNode: NodeOutput { + var outputNode: any NodeOutput { textOutputNode } // MARK: Animator Node Protocol - var propertyMap: NodePropertyMap & KeypathSearchable { + var propertyMap: any (NodePropertyMap & KeypathSearchable) { textAnimatorProperties } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift index 82bc247b39..0a10729403 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift @@ -14,7 +14,7 @@ import QuartzCore protocol NodeOutput { /// The parent node. - var parent: NodeOutput? { get } + var parent: (any NodeOutput)? { get } /// Returns true if there are any updates upstream. OutputPath must be built before returning. func hasOutputUpdates(_ forFrame: CGFloat) -> Bool @@ -46,13 +46,13 @@ protocol AnimatorNode: AnyObject, KeypathSearchable { /// These properties are also settable and gettable through the dynamic /// property system. /// - var propertyMap: NodePropertyMap & KeypathSearchable { get } + var propertyMap: any (NodePropertyMap & KeypathSearchable) { get } /// The upstream input node - var parentNode: AnimatorNode? { get } + var parentNode: (any AnimatorNode)? { get } /// The output of the node. - var outputNode: NodeOutput { get } + var outputNode: any NodeOutput { get } /// Update the outputs of the node. Called if local contents were update or if outputsNeedUpdate returns true. func rebuildOutputs(frame: CGFloat) @@ -182,11 +182,11 @@ extension AnimatorNode { propertyMap.keypathName } - var keypathProperties: [String: AnyNodeProperty] { + var keypathProperties: [String: any AnyNodeProperty] { propertyMap.keypathProperties } - var childKeypaths: [KeypathSearchable] { + var childKeypaths: [any KeypathSearchable] { propertyMap.childKeypaths } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift index defae81534..a572461dea 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift @@ -13,7 +13,7 @@ protocol PathNode { extension PathNode where Self: AnimatorNode { - var outputNode: NodeOutput { + var outputNode: any NodeOutput { pathOutput } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift index 959d47e00f..f75db515d0 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift @@ -11,7 +11,7 @@ import QuartzCore /// A protocol that defines a node that holds render instructions protocol RenderNode { - var renderer: Renderable & NodeOutput { get } + var renderer: any (Renderable & NodeOutput) { get } } // MARK: - Renderable @@ -44,7 +44,7 @@ protocol Renderable { extension RenderNode where Self: AnimatorNode { - var outputNode: NodeOutput { + var outputNode: any NodeOutput { renderer } diff --git a/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift b/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift index bd2eac2c5f..519175dd5c 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift @@ -12,7 +12,7 @@ final class ShapeRenderLayer: ShapeContainerLayer { // MARK: Lifecycle - init(renderer: Renderable & NodeOutput) { + init(renderer: any (Renderable & NodeOutput)) { self.renderer = renderer super.init() anchorPoint = .zero @@ -57,7 +57,7 @@ final class ShapeRenderLayer: ShapeContainerLayer { // MARK: Internal - fileprivate(set) var renderer: Renderable & NodeOutput + fileprivate(set) var renderer: any (Renderable & NodeOutput) let shapeLayer = CAShapeLayer() diff --git a/Sources/Private/Model/Assets/Asset.swift b/Sources/Private/Model/Assets/Asset.swift index 514f8226c4..7293410963 100644 --- a/Sources/Private/Model/Assets/Asset.swift +++ b/Sources/Private/Model/Assets/Asset.swift @@ -11,7 +11,7 @@ public class Asset: Codable, DictionaryInitializable { // MARK: Lifecycle - required public init(from decoder: Decoder) throws { + required public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Asset.CodingKeys.self) if let id = try? container.decode(String.self, forKey: .id) { self.id = id diff --git a/Sources/Private/Model/Assets/AssetLibrary.swift b/Sources/Private/Model/Assets/AssetLibrary.swift index 7d00b0b7e1..2994e7ce32 100644 --- a/Sources/Private/Model/Assets/AssetLibrary.swift +++ b/Sources/Private/Model/Assets/AssetLibrary.swift @@ -9,7 +9,7 @@ final class AssetLibrary: Codable, AnyInitializable, Sendable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { var container = try decoder.unkeyedContainer() var containerForKeys = container @@ -68,7 +68,7 @@ final class AssetLibrary: Codable, AnyInitializable, Sendable { let imageAssets: [String: ImageAsset] let precompAssets: [String: PrecompAsset] - func encode(to encoder: Encoder) throws { + func encode(to encoder: any Encoder) throws { var container = encoder.unkeyedContainer() try container.encode(contentsOf: Array(assets.values)) } diff --git a/Sources/Private/Model/Assets/ImageAsset.swift b/Sources/Private/Model/Assets/ImageAsset.swift index 4dc77d2f9d..21db1c57ce 100644 --- a/Sources/Private/Model/Assets/ImageAsset.swift +++ b/Sources/Private/Model/Assets/ImageAsset.swift @@ -20,7 +20,7 @@ public final class ImageAsset: Asset { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: ImageAsset.CodingKeys.self) name = try container.decode(String.self, forKey: .name) directory = try container.decode(String.self, forKey: .directory) @@ -50,7 +50,7 @@ public final class ImageAsset: Asset { public let height: Double - override public func encode(to encoder: Encoder) throws { + override public func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(name, forKey: .name) diff --git a/Sources/Private/Model/Assets/PrecompAsset.swift b/Sources/Private/Model/Assets/PrecompAsset.swift index dfd955e376..f08897ed62 100644 --- a/Sources/Private/Model/Assets/PrecompAsset.swift +++ b/Sources/Private/Model/Assets/PrecompAsset.swift @@ -9,7 +9,7 @@ final class PrecompAsset: Asset { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: PrecompAsset.CodingKeys.self) layers = try container.decode([LayerModel].self, ofFamily: LayerType.self, forKey: .layers) try super.init(from: decoder) @@ -30,7 +30,7 @@ final class PrecompAsset: Asset { /// Layers of the precomp let layers: [LayerModel] - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(layers, forKey: .layers) diff --git a/Sources/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift b/Sources/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift index 01e9d80cb1..7e25ce787a 100644 --- a/Sources/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +++ b/Sources/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift @@ -50,7 +50,7 @@ extension KeyedDecodingContainer { /// - key: The CodingKey to look up the list in the current container. /// - Returns: The resulting list of heterogeneousType elements. func decodeIfPresent(_: [T].Type, ofFamily family: U.Type, forKey key: K) throws -> [T]? { - var container: UnkeyedDecodingContainer + var container: any UnkeyedDecodingContainer do { container = try nestedUnkeyedContainer(forKey: key) } catch { diff --git a/Sources/Private/Model/Keyframes/KeyframeGroup.swift b/Sources/Private/Model/Keyframes/KeyframeGroup.swift index 5da4c4c1b0..90b5485967 100644 --- a/Sources/Private/Model/Keyframes/KeyframeGroup.swift +++ b/Sources/Private/Model/Keyframes/KeyframeGroup.swift @@ -50,7 +50,7 @@ final class KeyframeGroup { // MARK: Decodable extension KeyframeGroup: Decodable where T: Decodable { - convenience init(from decoder: Decoder) throws { + convenience init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: KeyframeWrapperKey.self) let unsupportedAfterEffectsExpression = try? container.decode(String.self, forKey: .unsupportedAfterEffectsExpression) @@ -112,7 +112,7 @@ extension KeyframeGroup: Decodable where T: Decodable { // MARK: Encodable extension KeyframeGroup: Encodable where T: Encodable { - func encode(to encoder: Encoder) throws { + func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: KeyframeWrapperKey.self) if keyframes.count == 1 { @@ -240,7 +240,7 @@ protocol AnyKeyframeGroup { var untyped: KeyframeGroup { get } /// An untyped `KeyframeInterpolator` for these keyframes - var interpolator: AnyValueProvider { get } + var interpolator: any AnyValueProvider { get } } // MARK: - KeyframeGroup + AnyKeyframeGroup @@ -250,7 +250,7 @@ extension KeyframeGroup: AnyKeyframeGroup where T: AnyInterpolatable { map { $0 as Any } } - var interpolator: AnyValueProvider { + var interpolator: any AnyValueProvider { KeyframeInterpolator(keyframes: keyframes) } } diff --git a/Sources/Private/Model/LayerEffects/DropShadowEffect.swift b/Sources/Private/Model/LayerEffects/DropShadowEffect.swift index 655c7f1d49..e5493fbf38 100644 --- a/Sources/Private/Model/LayerEffects/DropShadowEffect.swift +++ b/Sources/Private/Model/LayerEffects/DropShadowEffect.swift @@ -5,7 +5,7 @@ final class DropShadowEffect: LayerEffect { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { try super.init(from: decoder) } diff --git a/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift b/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift index 125c65d2c7..fa6cc3d723 100644 --- a/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +++ b/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift @@ -5,7 +5,7 @@ final class ColorEffectValue: EffectValue { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) value = try? container.decode(KeyframeGroup.self, forKey: .value) try super.init(from: decoder) @@ -22,7 +22,7 @@ final class ColorEffectValue: EffectValue { /// The value of the color let value: KeyframeGroup? - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(value, forKey: .value) diff --git a/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift b/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift index 4f154f52c9..9874bb3470 100644 --- a/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift +++ b/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift @@ -10,7 +10,7 @@ enum EffectValueType: Int, Codable, Sendable { case color = 2 case unknown = 9999 - init(from decoder: Decoder) throws { + init(from decoder: any Decoder) throws { self = try EffectValueType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .unknown } } @@ -41,7 +41,7 @@ class EffectValue: Codable, DictionaryInitializable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: EffectValue.CodingKeys.self) type = try container.decode(EffectValueType.self, forKey: .type) name = try container.decode(String.self, forKey: .name) diff --git a/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift b/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift index 59555a495e..213ec2cd2e 100644 --- a/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +++ b/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift @@ -5,7 +5,7 @@ final class Vector1DEffectValue: EffectValue { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) value = try? container.decode(KeyframeGroup.self, forKey: .value) try super.init(from: decoder) @@ -22,7 +22,7 @@ final class Vector1DEffectValue: EffectValue { /// The value of the slider let value: KeyframeGroup? - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(value, forKey: .value) diff --git a/Sources/Private/Model/LayerEffects/LayerEffect.swift b/Sources/Private/Model/LayerEffects/LayerEffect.swift index 654acfc2fc..ea92b63293 100644 --- a/Sources/Private/Model/LayerEffects/LayerEffect.swift +++ b/Sources/Private/Model/LayerEffects/LayerEffect.swift @@ -8,7 +8,7 @@ enum LayerEffectType: Int, Codable, Sendable { case dropShadow = 25 case unknown = 9999 - init(from decoder: Decoder) throws { + init(from decoder: any Decoder) throws { self = try LayerEffectType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .unknown } } @@ -35,7 +35,7 @@ class LayerEffect: Codable, DictionaryInitializable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: LayerEffect.CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) ?? "Effect" type = try container.decode(LayerEffectType.self, forKey: .type) diff --git a/Sources/Private/Model/LayerStyles/DropShadowStyle.swift b/Sources/Private/Model/LayerStyles/DropShadowStyle.swift index 1f2d14a904..11b6c5463b 100644 --- a/Sources/Private/Model/LayerStyles/DropShadowStyle.swift +++ b/Sources/Private/Model/LayerStyles/DropShadowStyle.swift @@ -5,7 +5,7 @@ final class DropShadowStyle: LayerStyle { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: DropShadowStyle.CodingKeys.self) opacity = try container.decode(KeyframeGroup.self, forKey: .opacity) color = try container.decode(KeyframeGroup.self, forKey: .color) @@ -48,7 +48,7 @@ final class DropShadowStyle: LayerStyle { /// The distance of the drop shadow let distance: KeyframeGroup - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(opacity, forKey: .opacity) diff --git a/Sources/Private/Model/LayerStyles/LayerStyle.swift b/Sources/Private/Model/LayerStyles/LayerStyle.swift index 70d28a5d5a..597fc9fa60 100644 --- a/Sources/Private/Model/LayerStyles/LayerStyle.swift +++ b/Sources/Private/Model/LayerStyles/LayerStyle.swift @@ -7,7 +7,7 @@ enum LayerStyleType: Int, Codable, Sendable { case dropShadow = 1 case unknown = 9999 - init(from decoder: Decoder) throws { + init(from decoder: any Decoder) throws { self = try LayerStyleType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .unknown } } @@ -34,7 +34,7 @@ class LayerStyle: Codable, DictionaryInitializable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: LayerStyle.CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) ?? "Style" type = try container.decode(LayerStyleType.self, forKey: .type) diff --git a/Sources/Private/Model/Layers/ImageLayerModel.swift b/Sources/Private/Model/Layers/ImageLayerModel.swift index 781e5c1f01..5ab5b362bd 100644 --- a/Sources/Private/Model/Layers/ImageLayerModel.swift +++ b/Sources/Private/Model/Layers/ImageLayerModel.swift @@ -10,7 +10,7 @@ final class ImageLayerModel: LayerModel { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: ImageLayerModel.CodingKeys.self) referenceID = try container.decode(String.self, forKey: .referenceID) try super.init(from: decoder) @@ -26,7 +26,7 @@ final class ImageLayerModel: LayerModel { /// The reference ID of the image. let referenceID: String - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(referenceID, forKey: .referenceID) diff --git a/Sources/Private/Model/Layers/LayerModel.swift b/Sources/Private/Model/Layers/LayerModel.swift index e2e3e38888..98635b9d97 100644 --- a/Sources/Private/Model/Layers/LayerModel.swift +++ b/Sources/Private/Model/Layers/LayerModel.swift @@ -42,7 +42,7 @@ public enum LayerType: Int, Codable { case text case unknown - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { self = try LayerType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .null } } @@ -84,7 +84,7 @@ class LayerModel: Codable, DictionaryInitializable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: LayerModel.CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) ?? "Layer" index = try container.decodeIfPresent(Int.self, forKey: .index) ?? .random(in: Int.min...Int.max) diff --git a/Sources/Private/Model/Layers/PreCompLayerModel.swift b/Sources/Private/Model/Layers/PreCompLayerModel.swift index a83214d75d..7001d43c50 100644 --- a/Sources/Private/Model/Layers/PreCompLayerModel.swift +++ b/Sources/Private/Model/Layers/PreCompLayerModel.swift @@ -10,7 +10,7 @@ final class PreCompLayerModel: LayerModel { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: PreCompLayerModel.CodingKeys.self) referenceID = try container.decode(String.self, forKey: .referenceID) timeRemapping = try container.decodeIfPresent(KeyframeGroup.self, forKey: .timeRemapping) @@ -45,7 +45,7 @@ final class PreCompLayerModel: LayerModel { /// Precomp Height let height: Double - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(referenceID, forKey: .referenceID) diff --git a/Sources/Private/Model/Layers/ShapeLayerModel.swift b/Sources/Private/Model/Layers/ShapeLayerModel.swift index 805da83a95..92b7980421 100644 --- a/Sources/Private/Model/Layers/ShapeLayerModel.swift +++ b/Sources/Private/Model/Layers/ShapeLayerModel.swift @@ -10,7 +10,7 @@ final class ShapeLayerModel: LayerModel { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: ShapeLayerModel.CodingKeys.self) items = try container.decode([ShapeItem].self, ofFamily: ShapeType.self, forKey: .items) try super.init(from: decoder) @@ -27,7 +27,7 @@ final class ShapeLayerModel: LayerModel { /// A list of shape items. let items: [ShapeItem] - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(items, forKey: .items) diff --git a/Sources/Private/Model/Layers/SolidLayerModel.swift b/Sources/Private/Model/Layers/SolidLayerModel.swift index 17312c90e1..05115cc5c5 100644 --- a/Sources/Private/Model/Layers/SolidLayerModel.swift +++ b/Sources/Private/Model/Layers/SolidLayerModel.swift @@ -10,7 +10,7 @@ final class SolidLayerModel: LayerModel { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: SolidLayerModel.CodingKeys.self) colorHex = try container.decode(String.self, forKey: .colorHex) width = try container.decode(Double.self, forKey: .width) @@ -36,7 +36,7 @@ final class SolidLayerModel: LayerModel { /// The height of the color layer let height: Double - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(colorHex, forKey: .colorHex) diff --git a/Sources/Private/Model/Layers/TextLayerModel.swift b/Sources/Private/Model/Layers/TextLayerModel.swift index 604a331f51..855c1bb5f0 100644 --- a/Sources/Private/Model/Layers/TextLayerModel.swift +++ b/Sources/Private/Model/Layers/TextLayerModel.swift @@ -10,7 +10,7 @@ final class TextLayerModel: LayerModel { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: TextLayerModel.CodingKeys.self) let textContainer = try container.nestedContainer(keyedBy: TextCodingKeys.self, forKey: .textGroup) text = try textContainer.decode(KeyframeGroup.self, forKey: .text) @@ -35,7 +35,7 @@ final class TextLayerModel: LayerModel { /// Text animators let animators: [TextAnimator] - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) var textContainer = container.nestedContainer(keyedBy: TextCodingKeys.self, forKey: .textGroup) diff --git a/Sources/Private/Model/Objects/Mask.swift b/Sources/Private/Model/Objects/Mask.swift index a3fa34b990..864e3f7a04 100644 --- a/Sources/Private/Model/Objects/Mask.swift +++ b/Sources/Private/Model/Objects/Mask.swift @@ -23,7 +23,7 @@ final class Mask: Codable, DictionaryInitializable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Mask.CodingKeys.self) mode = try container.decodeIfPresent(MaskMode.self, forKey: .mode) ?? .add opacity = try container diff --git a/Sources/Private/Model/Objects/Transform.swift b/Sources/Private/Model/Objects/Transform.swift index ced097a9e6..7db56fa2e4 100644 --- a/Sources/Private/Model/Objects/Transform.swift +++ b/Sources/Private/Model/Objects/Transform.swift @@ -10,7 +10,7 @@ final class Transform: Codable, DictionaryInitializable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { /// This manual override of decode is required because we want to throw an error /// in the case that there is not position data. let container = try decoder.container(keyedBy: Transform.CodingKeys.self) diff --git a/Sources/Private/Model/ShapeItems/Ellipse.swift b/Sources/Private/Model/ShapeItems/Ellipse.swift index 42f4bc10d8..751a576d92 100644 --- a/Sources/Private/Model/ShapeItems/Ellipse.swift +++ b/Sources/Private/Model/ShapeItems/Ellipse.swift @@ -19,7 +19,7 @@ final class Ellipse: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Ellipse.CodingKeys.self) direction = try container.decodeIfPresent(PathDirection.self, forKey: .direction) ?? .clockwise position = try container.decode(KeyframeGroup.self, forKey: .position) @@ -54,7 +54,7 @@ final class Ellipse: ShapeItem { /// The size of the ellipse let size: KeyframeGroup - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(direction, forKey: .direction) diff --git a/Sources/Private/Model/ShapeItems/Fill.swift b/Sources/Private/Model/ShapeItems/Fill.swift index f0090ae1ad..b8dc3deaff 100644 --- a/Sources/Private/Model/ShapeItems/Fill.swift +++ b/Sources/Private/Model/ShapeItems/Fill.swift @@ -19,7 +19,7 @@ final class Fill: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Fill.CodingKeys.self) opacity = try container.decode(KeyframeGroup.self, forKey: .opacity) color = try container.decode(KeyframeGroup.self, forKey: .color) @@ -54,7 +54,7 @@ final class Fill: ShapeItem { /// The fill rule to use when filling a path let fillRule: FillRule - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(opacity, forKey: .opacity) diff --git a/Sources/Private/Model/ShapeItems/GradientFill.swift b/Sources/Private/Model/ShapeItems/GradientFill.swift index 5e83880046..d154f0e2e6 100644 --- a/Sources/Private/Model/ShapeItems/GradientFill.swift +++ b/Sources/Private/Model/ShapeItems/GradientFill.swift @@ -19,7 +19,7 @@ final class GradientFill: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: GradientFill.CodingKeys.self) opacity = try container.decode(KeyframeGroup.self, forKey: .opacity) startPoint = try container.decode(KeyframeGroup.self, forKey: .startPoint) @@ -100,7 +100,7 @@ final class GradientFill: ShapeItem { /// The fill rule to use when filling a path let fillRule: FillRule - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(opacity, forKey: .opacity) diff --git a/Sources/Private/Model/ShapeItems/GradientStroke.swift b/Sources/Private/Model/ShapeItems/GradientStroke.swift index e2ef2bda1e..94a66c2cc6 100644 --- a/Sources/Private/Model/ShapeItems/GradientStroke.swift +++ b/Sources/Private/Model/ShapeItems/GradientStroke.swift @@ -29,7 +29,7 @@ final class GradientStroke: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: GradientStroke.CodingKeys.self) opacity = try container.decode(KeyframeGroup.self, forKey: .opacity) startPoint = try container.decode(KeyframeGroup.self, forKey: .startPoint) @@ -193,7 +193,7 @@ final class GradientStroke: ShapeItem { dashPattern: dashPattern) } - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(opacity, forKey: .opacity) diff --git a/Sources/Private/Model/ShapeItems/Group.swift b/Sources/Private/Model/ShapeItems/Group.swift index 84a48dde4d..936e3387ef 100644 --- a/Sources/Private/Model/ShapeItems/Group.swift +++ b/Sources/Private/Model/ShapeItems/Group.swift @@ -10,7 +10,7 @@ final class Group: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Group.CodingKeys.self) items = try container.decode([ShapeItem].self, ofFamily: ShapeType.self, forKey: .items) try super.init(from: decoder) @@ -32,7 +32,7 @@ final class Group: ShapeItem { /// A list of shape items. let items: [ShapeItem] - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(items, forKey: .items) diff --git a/Sources/Private/Model/ShapeItems/Merge.swift b/Sources/Private/Model/ShapeItems/Merge.swift index e14e5934e5..7d1402bdbc 100644 --- a/Sources/Private/Model/ShapeItems/Merge.swift +++ b/Sources/Private/Model/ShapeItems/Merge.swift @@ -22,7 +22,7 @@ final class Merge: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Merge.CodingKeys.self) mode = try container.decode(MergeMode.self, forKey: .mode) try super.init(from: decoder) @@ -42,7 +42,7 @@ final class Merge: ShapeItem { /// The mode of the merge path let mode: MergeMode - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(mode, forKey: .mode) diff --git a/Sources/Private/Model/ShapeItems/Rectangle.swift b/Sources/Private/Model/ShapeItems/Rectangle.swift index 339c1d7521..e545ec5c7c 100644 --- a/Sources/Private/Model/ShapeItems/Rectangle.swift +++ b/Sources/Private/Model/ShapeItems/Rectangle.swift @@ -9,7 +9,7 @@ final class Rectangle: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Rectangle.CodingKeys.self) direction = try container.decodeIfPresent(PathDirection.self, forKey: .direction) ?? .clockwise position = try container.decode(KeyframeGroup.self, forKey: .position) @@ -50,7 +50,7 @@ final class Rectangle: ShapeItem { /// The Corner radius of the rectangle let cornerRadius: KeyframeGroup - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(direction, forKey: .direction) diff --git a/Sources/Private/Model/ShapeItems/Repeater.swift b/Sources/Private/Model/ShapeItems/Repeater.swift index 7062bdd53b..2096172fef 100644 --- a/Sources/Private/Model/ShapeItems/Repeater.swift +++ b/Sources/Private/Model/ShapeItems/Repeater.swift @@ -9,7 +9,7 @@ final class Repeater: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Repeater.CodingKeys.self) copies = try container .decodeIfPresent(KeyframeGroup.self, forKey: .copies) ?? KeyframeGroup(LottieVector1D(0)) @@ -134,7 +134,7 @@ final class Repeater: ShapeItem { /// Scale let scale: KeyframeGroup - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(copies, forKey: .copies) diff --git a/Sources/Private/Model/ShapeItems/RoundedCorners.swift b/Sources/Private/Model/ShapeItems/RoundedCorners.swift index 6cc1aa8559..9c79eba820 100644 --- a/Sources/Private/Model/ShapeItems/RoundedCorners.swift +++ b/Sources/Private/Model/ShapeItems/RoundedCorners.swift @@ -11,7 +11,7 @@ final class RoundedCorners: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: RoundedCorners.CodingKeys.self) radius = try container.decode( @@ -31,7 +31,7 @@ final class RoundedCorners: ShapeItem { /// The radius of rounded corners let radius: KeyframeGroup - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(radius, forKey: .radius) diff --git a/Sources/Private/Model/ShapeItems/Shape.swift b/Sources/Private/Model/ShapeItems/Shape.swift index eb5158bf11..8cf13f9f94 100644 --- a/Sources/Private/Model/ShapeItems/Shape.swift +++ b/Sources/Private/Model/ShapeItems/Shape.swift @@ -10,7 +10,7 @@ final class Shape: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Shape.CodingKeys.self) path = try container.decode(KeyframeGroup.self, forKey: .path) direction = try container.decodeIfPresent(PathDirection.self, forKey: .direction) @@ -38,7 +38,7 @@ final class Shape: ShapeItem { let direction: PathDirection? - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(path, forKey: .path) diff --git a/Sources/Private/Model/ShapeItems/ShapeItem.swift b/Sources/Private/Model/ShapeItems/ShapeItem.swift index f058100600..52bc5161d1 100644 --- a/Sources/Private/Model/ShapeItems/ShapeItem.swift +++ b/Sources/Private/Model/ShapeItems/ShapeItem.swift @@ -24,7 +24,7 @@ enum ShapeType: String, Codable, Sendable { case transform = "tr" case unknown - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { self = try ShapeType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .unknown } } @@ -78,7 +78,7 @@ class ShapeItem: Codable, DictionaryInitializable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: ShapeItem.CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) ?? "Layer" type = try container.decode(ShapeType.self, forKey: .type) diff --git a/Sources/Private/Model/ShapeItems/ShapeTransform.swift b/Sources/Private/Model/ShapeItems/ShapeTransform.swift index 26c13db45d..c0a9a9bf93 100644 --- a/Sources/Private/Model/ShapeItems/ShapeTransform.swift +++ b/Sources/Private/Model/ShapeItems/ShapeTransform.swift @@ -9,7 +9,7 @@ final class ShapeTransform: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: ShapeTransform.CodingKeys.self) anchor = try container .decodeIfPresent(KeyframeGroup.self, forKey: .anchor) ?? @@ -162,7 +162,7 @@ final class ShapeTransform: ShapeItem { /// Skew Axis let skewAxis: KeyframeGroup - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(anchor, forKey: .anchor) diff --git a/Sources/Private/Model/ShapeItems/Star.swift b/Sources/Private/Model/ShapeItems/Star.swift index 06bd869d66..775b8bc7ec 100644 --- a/Sources/Private/Model/ShapeItems/Star.swift +++ b/Sources/Private/Model/ShapeItems/Star.swift @@ -19,7 +19,7 @@ final class Star: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Star.CodingKeys.self) direction = try container.decodeIfPresent(PathDirection.self, forKey: .direction) ?? .clockwise position = try container.decode(KeyframeGroup.self, forKey: .position) @@ -99,7 +99,7 @@ final class Star: ShapeItem { /// The type of star let starType: StarType - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(direction, forKey: .direction) diff --git a/Sources/Private/Model/ShapeItems/Stroke.swift b/Sources/Private/Model/ShapeItems/Stroke.swift index c9f5e8b1cc..bd3d00429c 100644 --- a/Sources/Private/Model/ShapeItems/Stroke.swift +++ b/Sources/Private/Model/ShapeItems/Stroke.swift @@ -9,7 +9,7 @@ final class Stroke: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Stroke.CodingKeys.self) opacity = try container.decode(KeyframeGroup.self, forKey: .opacity) color = try container.decode(KeyframeGroup.self, forKey: .color) @@ -108,7 +108,7 @@ final class Stroke: ShapeItem { dashPattern: dashPattern) } - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(opacity, forKey: .opacity) diff --git a/Sources/Private/Model/ShapeItems/Trim.swift b/Sources/Private/Model/ShapeItems/Trim.swift index 0843d8858b..cf52bcbd95 100644 --- a/Sources/Private/Model/ShapeItems/Trim.swift +++ b/Sources/Private/Model/ShapeItems/Trim.swift @@ -18,7 +18,7 @@ final class Trim: ShapeItem { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Trim.CodingKeys.self) start = try container.decode(KeyframeGroup.self, forKey: .start) end = try container.decode(KeyframeGroup.self, forKey: .end) @@ -63,7 +63,7 @@ final class Trim: ShapeItem { && end.keyframes[0].value.value == 100 } - override func encode(to encoder: Encoder) throws { + override func encode(to encoder: any Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(start, forKey: .start) diff --git a/Sources/Private/Model/Text/Glyph.swift b/Sources/Private/Model/Text/Glyph.swift index 7c68c0701e..d81373c9a9 100644 --- a/Sources/Private/Model/Text/Glyph.swift +++ b/Sources/Private/Model/Text/Glyph.swift @@ -10,7 +10,7 @@ final class Glyph: Codable, Sendable, DictionaryInitializable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: Glyph.CodingKeys.self) character = try container.decode(String.self, forKey: .character) fontSize = try container.decode(Double.self, forKey: .fontSize) @@ -64,7 +64,7 @@ final class Glyph: Codable, Sendable, DictionaryInitializable { /// The Shape Data of the Character let shapes: [ShapeItem] - func encode(to encoder: Encoder) throws { + func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(character, forKey: .character) diff --git a/Sources/Private/Model/Text/TextAnimator.swift b/Sources/Private/Model/Text/TextAnimator.swift index 0ff9415e4f..c8d0bf1dce 100644 --- a/Sources/Private/Model/Text/TextAnimator.swift +++ b/Sources/Private/Model/Text/TextAnimator.swift @@ -18,7 +18,7 @@ final class TextAnimator: Codable, DictionaryInitializable { // MARK: Lifecycle - required init(from decoder: Decoder) throws { + required init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: TextAnimator.CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) ?? "" @@ -197,7 +197,7 @@ final class TextAnimator: Codable, DictionaryInitializable { /// The type of unit used by the start/end ranges let textRangeUnit: TextRangeUnit? - func encode(to encoder: Encoder) throws { + func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) var animatorContainer = container.nestedContainer(keyedBy: TextAnimatorKeys.self, forKey: .textAnimator) try animatorContainer.encodeIfPresent(fillColor, forKey: .fillColor) diff --git a/Sources/Private/RootAnimationLayer.swift b/Sources/Private/RootAnimationLayer.swift index aa1854162c..d158ac897a 100644 --- a/Sources/Private/RootAnimationLayer.swift +++ b/Sources/Private/RootAnimationLayer.swift @@ -14,9 +14,9 @@ protocol RootAnimationLayer: CALayer { var respectAnimationFrameRate: Bool { get set } var _animationLayers: [CALayer] { get } - var imageProvider: AnimationImageProvider { get set } - var textProvider: AnimationKeypathTextProvider { get set } - var fontProvider: AnimationFontProvider { get set } + var imageProvider: any AnimationImageProvider { get set } + var textProvider: any AnimationKeypathTextProvider { get set } + var fontProvider: any AnimationFontProvider { get set } /// The `CAAnimation` key corresponding to the primary animation. /// - `LottieAnimationView` uses this key to check if the animation is still active @@ -35,12 +35,12 @@ protocol RootAnimationLayer: CALayer { func forceDisplayUpdate() func logHierarchyKeypaths() func allHierarchyKeypaths() -> [String] - func setValueProvider(_ valueProvider: AnyValueProvider, keypath: AnimationKeypath) + func setValueProvider(_ valueProvider: any AnyValueProvider, keypath: AnimationKeypath) func getValue(for keypath: AnimationKeypath, atFrame: AnimationFrameTime?) -> Any? func getOriginalValue(for keypath: AnimationKeypath, atFrame: AnimationFrameTime?) -> Any? func layer(for keypath: AnimationKeypath) -> CALayer? - func animatorNodes(for keypath: AnimationKeypath) -> [AnimatorNode]? + func animatorNodes(for keypath: AnimationKeypath) -> [any AnimatorNode]? } // MARK: - AnimationKey diff --git a/Sources/Private/Utility/Debugging/LayerDebugging.swift b/Sources/Private/Utility/Debugging/LayerDebugging.swift index 601ec870f7..efed9dd8c6 100644 --- a/Sources/Private/Utility/Debugging/LayerDebugging.swift +++ b/Sources/Private/Utility/Debugging/LayerDebugging.swift @@ -75,7 +75,7 @@ extension CALayer { @nonobjc func setDebuggingState(visible: Bool) { var sublayers = sublayers - if let cust = self as? CustomLayerDebugging { + if let cust = self as? any CustomLayerDebugging { sublayers = cust.layerForDebugging().sublayers } @@ -96,14 +96,14 @@ extension CALayer { if visible { let style: LayerDebugStyle = - if let layerDebugging = self as? LayerDebugging { + if let layerDebugging = self as? any LayerDebugging { layerDebugging.debugStyle } else { LayerDebugStyle.defaultStyle() } let debugLayer = DebugLayer(style: style) var container = self - if let cust = self as? CustomLayerDebugging { + if let cust = self as? any CustomLayerDebugging { container = cust.layerForDebugging() } container.addSublayer(debugLayer) diff --git a/Sources/Private/Utility/Extensions/AnimationKeypathExtension.swift b/Sources/Private/Utility/Extensions/AnimationKeypathExtension.swift index f79920e3e6..21935709df 100644 --- a/Sources/Private/Utility/Extensions/AnimationKeypathExtension.swift +++ b/Sources/Private/Utility/Extensions/AnimationKeypathExtension.swift @@ -9,7 +9,7 @@ import QuartzCore extension KeypathSearchable { - func animatorNodes(for keyPath: AnimationKeypath) -> [AnimatorNode]? { + func animatorNodes(for keyPath: AnimationKeypath) -> [any AnimatorNode]? { // Make sure there is a current key path. guard let currentKey = keyPath.currentKey else { return nil } @@ -17,7 +17,7 @@ extension KeypathSearchable { guard let nextKeypath = keyPath.popKey(keypathName) else { // We may be on the final keypath. Check for match. if - let node = self as? AnimatorNode, + let node = self as? any AnimatorNode, currentKey.equalsKeypath(keypathName) { // This is the final keypath and matches self. Return.s @@ -27,10 +27,10 @@ extension KeypathSearchable { return nil } - var results: [AnimatorNode] = [] + var results: [any AnimatorNode] = [] if - let node = self as? AnimatorNode, + let node = self as? any AnimatorNode, nextKeypath.currentKey == nil { // Keypath matched self and was the final keypath. @@ -61,14 +61,14 @@ extension KeypathSearchable { return results } - func nodeProperties(for keyPath: AnimationKeypath) -> [AnyNodeProperty]? { + func nodeProperties(for keyPath: AnimationKeypath) -> [any AnyNodeProperty]? { guard let nextKeypath = keyPath.popKey(keypathName) else { /// Nope. Stop Search return nil } /// Keypath matches in some way. Continue the search. - var results: [AnyNodeProperty] = [] + var results: [any AnyNodeProperty] = [] /// Check if we have a property keypath yet if diff --git a/Sources/Private/Utility/Helpers/AnimationContext.swift b/Sources/Private/Utility/Helpers/AnimationContext.swift index 8d6cba046c..fec6293c53 100644 --- a/Sources/Private/Utility/Helpers/AnimationContext.swift +++ b/Sources/Private/Utility/Helpers/AnimationContext.swift @@ -83,7 +83,7 @@ class AnimationCompletionDelegate: NSObject, CAAnimationDelegate { // MARK: Internal - var animationLayer: RootAnimationLayer? + var animationLayer: (any RootAnimationLayer)? var animationKey: String? var ignoreDelegate = false var animationState: AnimationContextState = .playing diff --git a/Sources/Private/Utility/Primitives/BezierPath.swift b/Sources/Private/Utility/Primitives/BezierPath.swift index 8183a47ea7..2328d7470f 100644 --- a/Sources/Private/Utility/Primitives/BezierPath.swift +++ b/Sources/Private/Utility/Primitives/BezierPath.swift @@ -289,7 +289,7 @@ extension BezierPath: Codable { // MARK: Lifecycle - init(from decoder: Decoder) throws { + init(from decoder: any Decoder) throws { let container: KeyedDecodingContainer if let keyedContainer = try? decoder.container(keyedBy: BezierPath.CodingKeys.self) { @@ -378,7 +378,7 @@ extension BezierPath: Codable { case vertices = "v" } - func encode(to encoder: Encoder) throws { + func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: BezierPath.CodingKeys.self) try container.encode(closed, forKey: .closed) diff --git a/Sources/Private/Utility/Primitives/ColorExtension.swift b/Sources/Private/Utility/Primitives/ColorExtension.swift index 4fe60b1a06..89339aec4f 100644 --- a/Sources/Private/Utility/Primitives/ColorExtension.swift +++ b/Sources/Private/Utility/Primitives/ColorExtension.swift @@ -13,7 +13,7 @@ extension LottieColor: Codable { // MARK: Lifecycle - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { var container = try decoder.unkeyedContainer() var r1: Double = @@ -53,7 +53,7 @@ extension LottieColor: Codable { // MARK: Public - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.unkeyedContainer() try container.encode(r) try container.encode(g) diff --git a/Sources/Private/Utility/Primitives/VectorsExtensions.swift b/Sources/Private/Utility/Primitives/VectorsExtensions.swift index 626fd33ec4..d7e0ad45f6 100644 --- a/Sources/Private/Utility/Primitives/VectorsExtensions.swift +++ b/Sources/Private/Utility/Primitives/VectorsExtensions.swift @@ -16,7 +16,7 @@ extension LottieVector1D: Codable { // MARK: Lifecycle - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { /// Try to decode an array of doubles do { var container = try decoder.unkeyedContainer() @@ -28,7 +28,7 @@ extension LottieVector1D: Codable { // MARK: Public - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.singleValueContainer() try container.encode(value) } @@ -78,7 +78,7 @@ public struct LottieVector2D: Codable, Hashable, Sendable { self.y = y } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: LottieVector2D.CodingKeys.self) do { @@ -98,7 +98,7 @@ public struct LottieVector2D: Codable, Hashable, Sendable { // MARK: Public - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: LottieVector2D.CodingKeys.self) try container.encode(x, forKey: .x) try container.encode(y, forKey: .y) @@ -174,7 +174,7 @@ extension LottieVector3D: Codable { self.z = Double(z) } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { var container = try decoder.unkeyedContainer() if !container.isAtEnd { @@ -198,7 +198,7 @@ extension LottieVector3D: Codable { // MARK: Public - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.unkeyedContainer() try container.encode(x) try container.encode(y) diff --git a/Sources/Public/Animation/LottieAnimation.swift b/Sources/Public/Animation/LottieAnimation.swift index 0893eeeeab..154e73875a 100644 --- a/Sources/Public/Animation/LottieAnimation.swift +++ b/Sources/Public/Animation/LottieAnimation.swift @@ -24,7 +24,7 @@ public final class LottieAnimation: Codable, Sendable, DictionaryInitializable { // MARK: Lifecycle - required public init(from decoder: Decoder) throws { + required public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: LottieAnimation.CodingKeys.self) version = try container.decode(String.self, forKey: .version) type = try container.decodeIfPresent(CoordinateSpace.self, forKey: .type) ?? .type2d diff --git a/Sources/Public/Animation/LottieAnimationHelpers.swift b/Sources/Public/Animation/LottieAnimationHelpers.swift index 337dc9a863..cdf0087f23 100644 --- a/Sources/Public/Animation/LottieAnimationHelpers.swift +++ b/Sources/Public/Animation/LottieAnimationHelpers.swift @@ -42,7 +42,7 @@ extension LottieAnimation { _ name: String, bundle: Bundle = Bundle.main, subdirectory: String? = nil, - animationCache: AnimationCacheProvider? = LottieAnimationCache.shared) + animationCache: (any AnimationCacheProvider)? = LottieAnimationCache.shared) -> LottieAnimation? { /// Create a cache key for the animation. @@ -77,7 +77,7 @@ extension LottieAnimation { /// - Returns: Deserialized `LottieAnimation`. Optional. public static func filepath( _ filepath: String, - animationCache: AnimationCacheProvider? = LottieAnimationCache.shared) + animationCache: (any AnimationCacheProvider)? = LottieAnimationCache.shared) -> LottieAnimation? { /// Check cache for animation @@ -111,7 +111,7 @@ extension LottieAnimation { public static func asset( _ name: String, bundle: Bundle = Bundle.main, - animationCache: AnimationCacheProvider? = LottieAnimationCache.shared) + animationCache: (any AnimationCacheProvider)? = LottieAnimationCache.shared) -> LottieAnimation? { /// Create a cache key for the animation. @@ -174,7 +174,7 @@ extension LottieAnimation { public static func loadedFrom( url: URL, session: URLSession = .shared, - animationCache: AnimationCacheProvider? = LottieAnimationCache.shared) + animationCache: (any AnimationCacheProvider)? = LottieAnimationCache.shared) async -> LottieAnimation? { await withCheckedContinuation { continuation in @@ -198,7 +198,7 @@ extension LottieAnimation { url: URL, session: URLSession = .shared, closure: @escaping LottieAnimation.DownloadClosure, - animationCache: AnimationCacheProvider? = LottieAnimationCache.shared) + animationCache: (any AnimationCacheProvider)? = LottieAnimationCache.shared) { if let animationCache, let animation = animationCache.animation(forKey: url.absoluteString) { closure(animation) diff --git a/Sources/Public/Animation/LottieAnimationLayer.swift b/Sources/Public/Animation/LottieAnimationLayer.swift index e686665995..ca52b35433 100644 --- a/Sources/Public/Animation/LottieAnimationLayer.swift +++ b/Sources/Public/Animation/LottieAnimationLayer.swift @@ -16,9 +16,9 @@ public class LottieAnimationLayer: CALayer { /// Initializes a LottieAnimationLayer with an animation. public init( animation: LottieAnimation?, - imageProvider: AnimationImageProvider? = nil, - textProvider: AnimationKeypathTextProvider = DefaultTextProvider(), - fontProvider: AnimationFontProvider = DefaultFontProvider(), + imageProvider: (any AnimationImageProvider)? = nil, + textProvider: any AnimationKeypathTextProvider = DefaultTextProvider(), + fontProvider: any AnimationFontProvider = DefaultFontProvider(), configuration: LottieConfiguration = .shared, logger: LottieLogger = .shared) { @@ -40,8 +40,8 @@ public class LottieAnimationLayer: CALayer { public init( dotLottie: DotLottieFile?, animationId: String? = nil, - textProvider: AnimationKeypathTextProvider = DefaultTextProvider(), - fontProvider: AnimationFontProvider = DefaultFontProvider(), + textProvider: any AnimationKeypathTextProvider = DefaultTextProvider(), + fontProvider: any AnimationFontProvider = DefaultFontProvider(), configuration: LottieConfiguration = .shared, logger: LottieLogger = .shared) { @@ -484,7 +484,7 @@ public class LottieAnimationLayer: CALayer { public private(set) var currentPlaybackMode: LottiePlaybackMode? /// Value Providers that have been registered using `setValueProvider(_:keypath:)` - public private(set) var valueProviders = [AnimationKeypath: AnyValueProvider]() + public private(set) var valueProviders = [AnimationKeypath: any AnyValueProvider]() /// A closure called when the animation layer has been loaded. /// Will inform the receiver the type of rendering engine that is used for the layer. @@ -594,7 +594,7 @@ public class LottieAnimationLayer: CALayer { /// animation with its required image data. /// /// Setting this will cause the animation to reload its image contents. - public var imageProvider: AnimationImageProvider { + public var imageProvider: any AnimationImageProvider { didSet { rootAnimationLayer?.imageProvider = imageProvider.cachedImageProvider reloadImages() @@ -603,7 +603,7 @@ public class LottieAnimationLayer: CALayer { /// Sets the text provider for animation layer. A text provider provides the /// animation with values for text layers - public var textProvider: AnimationKeypathTextProvider { + public var textProvider: any AnimationKeypathTextProvider { didSet { rootAnimationLayer?.textProvider = textProvider } @@ -611,7 +611,7 @@ public class LottieAnimationLayer: CALayer { /// Sets the text provider for animation layer. A text provider provides the /// animation with values for text layers - public var fontProvider: AnimationFontProvider { + public var fontProvider: any AnimationFontProvider { didSet { rootAnimationLayer?.fontProvider = fontProvider } @@ -847,7 +847,7 @@ public class LottieAnimationLayer: CALayer { /// /// Set the provider on the animationView. /// animationView.setValueProvider(redValueProvider, keypath: fillKeypath) /// ``` - public func setValueProvider(_ valueProvider: AnyValueProvider, keypath: AnimationKeypath) { + public func setValueProvider(_ valueProvider: any AnyValueProvider, keypath: AnimationKeypath) { guard let animationLayer = rootAnimationLayer else { return } valueProviders[keypath] = valueProvider @@ -1026,7 +1026,7 @@ public class LottieAnimationLayer: CALayer { // MARK: Internal - var rootAnimationLayer: RootAnimationLayer? = nil + var rootAnimationLayer: (any RootAnimationLayer)? = nil /// Context describing the animation that is currently playing in this `LottieAnimationView` /// - When non-nil, an animation is currently playing in this layer. Otherwise, @@ -1153,7 +1153,7 @@ public class LottieAnimationLayer: CALayer { guard let animation else { return } - let rootAnimationLayer: RootAnimationLayer? = + let rootAnimationLayer: (any RootAnimationLayer)? = switch renderingEngine { case .automatic: makeAutomaticEngineLayer(for: animation) diff --git a/Sources/Public/Animation/LottieAnimationView.swift b/Sources/Public/Animation/LottieAnimationView.swift index 0ddec0ba3c..a594f7ae14 100644 --- a/Sources/Public/Animation/LottieAnimationView.swift +++ b/Sources/Public/Animation/LottieAnimationView.swift @@ -98,9 +98,9 @@ open class LottieAnimationView: LottieAnimationViewBase { /// Initializes an AnimationView with an animation. public init( animation: LottieAnimation?, - imageProvider: AnimationImageProvider? = nil, - textProvider: AnimationKeypathTextProvider = DefaultTextProvider(), - fontProvider: AnimationFontProvider = DefaultFontProvider(), + imageProvider: (any AnimationImageProvider)? = nil, + textProvider: any AnimationKeypathTextProvider = DefaultTextProvider(), + fontProvider: any AnimationFontProvider = DefaultFontProvider(), configuration: LottieConfiguration = .shared, logger: LottieLogger = .shared) { @@ -123,8 +123,8 @@ open class LottieAnimationView: LottieAnimationViewBase { public init( dotLottie: DotLottieFile?, animationId: String? = nil, - textProvider: AnimationKeypathTextProvider = DefaultTextProvider(), - fontProvider: AnimationFontProvider = DefaultFontProvider(), + textProvider: any AnimationKeypathTextProvider = DefaultTextProvider(), + fontProvider: any AnimationFontProvider = DefaultFontProvider(), configuration: LottieConfiguration = .shared, logger: LottieLogger = .shared) { @@ -181,9 +181,9 @@ open class LottieAnimationView: LottieAnimationViewBase { convenience init( animationSource: LottieAnimationSource?, - imageProvider: AnimationImageProvider? = nil, - textProvider: AnimationKeypathTextProvider = DefaultTextProvider(), - fontProvider: AnimationFontProvider = DefaultFontProvider(), + imageProvider: (any AnimationImageProvider)? = nil, + textProvider: any AnimationKeypathTextProvider = DefaultTextProvider(), + fontProvider: any AnimationFontProvider = DefaultFontProvider(), configuration: LottieConfiguration = .shared, logger: LottieLogger = .shared) { @@ -381,7 +381,7 @@ open class LottieAnimationView: LottieAnimationViewBase { } /// Value Providers that have been registered using `setValueProvider(_:keypath:)` - public var valueProviders: [AnimationKeypath: AnyValueProvider] { + public var valueProviders: [AnimationKeypath: any AnyValueProvider] { lottieAnimationLayer.valueProviders } @@ -447,21 +447,21 @@ open class LottieAnimationView: LottieAnimationViewBase { /// animation with its required image data. /// /// Setting this will cause the animation to reload its image contents. - public var imageProvider: AnimationImageProvider { + public var imageProvider: any AnimationImageProvider { get { lottieAnimationLayer.imageProvider } set { lottieAnimationLayer.imageProvider = newValue } } /// Sets the text provider for animation view. A text provider provides the /// animation with values for text layers - public var textProvider: AnimationKeypathTextProvider { + public var textProvider: any AnimationKeypathTextProvider { get { lottieAnimationLayer.textProvider } set { lottieAnimationLayer.textProvider = newValue } } /// Sets the text provider for animation view. A text provider provides the /// animation with values for text layers - public var fontProvider: AnimationFontProvider { + public var fontProvider: any AnimationFontProvider { get { lottieAnimationLayer.fontProvider } set { lottieAnimationLayer.fontProvider = newValue } } @@ -669,7 +669,7 @@ open class LottieAnimationView: LottieAnimationViewBase { /// /// Set the provider on the animationView. /// animationView.setValueProvider(redValueProvider, keypath: fillKeypath) /// ``` - public func setValueProvider(_ valueProvider: AnyValueProvider, keypath: AnimationKeypath) { + public func setValueProvider(_ valueProvider: any AnyValueProvider, keypath: AnimationKeypath) { lottieAnimationLayer.setValueProvider(valueProvider, keypath: keypath) } @@ -816,7 +816,7 @@ open class LottieAnimationView: LottieAnimationViewBase { /// The backing CALayer for this animation view. let lottieAnimationLayer: LottieAnimationLayer - var animationLayer: RootAnimationLayer? { + var animationLayer: (any RootAnimationLayer)? { lottieAnimationLayer.rootAnimationLayer } diff --git a/Sources/Public/Animation/LottieAnimationViewInitializers.swift b/Sources/Public/Animation/LottieAnimationViewInitializers.swift index 919cc934f2..8d001dbe63 100644 --- a/Sources/Public/Animation/LottieAnimationViewInitializers.swift +++ b/Sources/Public/Animation/LottieAnimationViewInitializers.swift @@ -22,8 +22,8 @@ extension LottieAnimationView { name: String, bundle: Bundle = Bundle.main, subdirectory: String? = nil, - imageProvider: AnimationImageProvider? = nil, - animationCache: AnimationCacheProvider? = LottieAnimationCache.shared, + imageProvider: (any AnimationImageProvider)? = nil, + animationCache: (any AnimationCacheProvider)? = LottieAnimationCache.shared, configuration: LottieConfiguration = .shared) { let animation = LottieAnimation.named(name, bundle: bundle, subdirectory: subdirectory, animationCache: animationCache) @@ -38,8 +38,8 @@ extension LottieAnimationView { /// If none is supplied Lottie will search in the supplied filepath for images. public convenience init( filePath: String, - imageProvider: AnimationImageProvider? = nil, - animationCache: AnimationCacheProvider? = LottieAnimationCache.shared, + imageProvider: (any AnimationImageProvider)? = nil, + animationCache: (any AnimationCacheProvider)? = LottieAnimationCache.shared, configuration: LottieConfiguration = .shared) { let animation = LottieAnimation.filepath(filePath, animationCache: animationCache) @@ -56,10 +56,10 @@ extension LottieAnimationView { /// - Parameter closure: A closure to be called when the animation has loaded. public convenience init( url: URL, - imageProvider: AnimationImageProvider? = nil, + imageProvider: (any AnimationImageProvider)? = nil, session: URLSession = .shared, closure: @escaping LottieAnimationView.DownloadClosure, - animationCache: AnimationCacheProvider? = LottieAnimationCache.shared, + animationCache: (any AnimationCacheProvider)? = LottieAnimationCache.shared, configuration: LottieConfiguration = .shared) { if let animationCache, let animation = animationCache.animation(forKey: url.absoluteString) { @@ -88,8 +88,8 @@ extension LottieAnimationView { public convenience init( asset name: String, bundle: Bundle = Bundle.main, - imageProvider: AnimationImageProvider? = nil, - animationCache: AnimationCacheProvider? = LottieAnimationCache.shared, + imageProvider: (any AnimationImageProvider)? = nil, + animationCache: (any AnimationCacheProvider)? = LottieAnimationCache.shared, configuration: LottieConfiguration = .shared) { let animation = LottieAnimation.asset(name, bundle: bundle, animationCache: animationCache) @@ -112,9 +112,9 @@ extension LottieAnimationView { bundle: Bundle = Bundle.main, subdirectory: String? = nil, animationId: String? = nil, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache, + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache, configuration: LottieConfiguration = .shared, - completion: ((LottieAnimationView, Error?) -> Void)? = nil) + completion: ((LottieAnimationView, (any Error)?) -> Void)? = nil) { self.init(dotLottie: nil, animationId: animationId, configuration: configuration) DotLottieFile.named(name, bundle: bundle, subdirectory: subdirectory, dotLottieCache: dotLottieCache) { result in @@ -138,9 +138,9 @@ extension LottieAnimationView { public convenience init( dotLottieFilePath filePath: String, animationId: String? = nil, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache, + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache, configuration: LottieConfiguration = .shared, - completion: ((LottieAnimationView, Error?) -> Void)? = nil) + completion: ((LottieAnimationView, (any Error)?) -> Void)? = nil) { self.init(dotLottie: nil, animationId: animationId, configuration: configuration) DotLottieFile.loadedFrom(filepath: filePath, dotLottieCache: dotLottieCache) { result in @@ -163,10 +163,10 @@ extension LottieAnimationView { public convenience init( dotLottieUrl url: URL, animationId: String? = nil, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache, + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache, configuration: LottieConfiguration = .shared, session: URLSession = .shared, - completion: ((LottieAnimationView, Error?) -> Void)? = nil) + completion: ((LottieAnimationView, (any Error)?) -> Void)? = nil) { if let dotLottieCache, let lottie = dotLottieCache.file(forKey: url.absoluteString) { self.init(dotLottie: lottie, animationId: animationId, configuration: configuration) @@ -196,9 +196,9 @@ extension LottieAnimationView { dotLottieAsset name: String, bundle: Bundle = Bundle.main, animationId: String? = nil, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache, + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache, configuration: LottieConfiguration = .shared, - completion: ((LottieAnimationView, Error?) -> Void)? = nil) + completion: ((LottieAnimationView, (any Error)?) -> Void)? = nil) { self.init(dotLottie: nil, animationId: animationId, configuration: configuration) DotLottieFile.asset(named: name, bundle: bundle, dotLottieCache: dotLottieCache) { result in @@ -215,7 +215,7 @@ extension LottieAnimationView { // MARK: Public - public typealias DownloadClosure = (Error?) -> Void + public typealias DownloadClosure = ((any Error)?) -> Void } diff --git a/Sources/Public/Animation/LottieView.swift b/Sources/Public/Animation/LottieView.swift index aae74dfd46..7d61e99c48 100644 --- a/Sources/Public/Animation/LottieView.swift +++ b/Sources/Public/Animation/LottieView.swift @@ -503,8 +503,8 @@ public struct LottieView: UIViewConfiguringSwiftUIView { private var animationDidLoad: ((LottieAnimationSource) -> Void)? private var animationCompletionHandler: LottieCompletionBlock? private var showPlaceholderWhileReloading = false - private var textProvider: AnimationKeypathTextProvider = DefaultTextProvider() - private var fontProvider: AnimationFontProvider = DefaultFontProvider() + private var textProvider: any AnimationKeypathTextProvider = DefaultTextProvider() + private var fontProvider: any AnimationFontProvider = DefaultFontProvider() private var configuration: LottieConfiguration = .shared private var dotLottieConfigurationComponents: DotLottieConfigurationComponents = .imageProvider private var logger: LottieLogger = .shared @@ -512,8 +512,8 @@ public struct LottieView: UIViewConfiguringSwiftUIView { private let placeholder: (() -> Placeholder)? private var imageProviderConfiguration: ( - imageProvider: AnimationImageProvider, - imageProvidersAreEqual: (AnimationImageProvider, AnimationImageProvider) -> Bool)? + imageProvider: any AnimationImageProvider, + imageProvidersAreEqual: (any AnimationImageProvider, any AnimationImageProvider) -> Bool)? private var animationSource: LottieAnimationSource? { localAnimation ?? remoteAnimation diff --git a/Sources/Public/AnimationCache/LottieAnimationCache.swift b/Sources/Public/AnimationCache/LottieAnimationCache.swift index efb6a3ee39..800eb42f1a 100644 --- a/Sources/Public/AnimationCache/LottieAnimationCache.swift +++ b/Sources/Public/AnimationCache/LottieAnimationCache.swift @@ -11,5 +11,5 @@ public enum LottieAnimationCache { /// The animation cache that will be used when loading `LottieAnimation` models. /// Using an Animation Cache can increase performance when loading an animation multiple times. /// Defaults to DefaultAnimationCache.sharedCache. - public static var shared: AnimationCacheProvider? = DefaultAnimationCache.sharedCache + public static var shared: (any AnimationCacheProvider)? = DefaultAnimationCache.sharedCache } diff --git a/Sources/Public/Configuration/ReducedMotionOption.swift b/Sources/Public/Configuration/ReducedMotionOption.swift index 040d9d3548..d5e155ae46 100644 --- a/Sources/Public/Configuration/ReducedMotionOption.swift +++ b/Sources/Public/Configuration/ReducedMotionOption.swift @@ -17,7 +17,7 @@ public enum ReducedMotionOption { /// Dynamically check the given `ReducedMotionOptionProvider` each time an animation begins. /// - Includes a Hashable `dataID` to support `ReducedMotionOption`'s `Hashable` requirement, /// which is required due to `LottieConfiguration`'s existing `Hashable` requirement. - case dynamic(ReducedMotionOptionProvider, dataID: AnyHashable) + case dynamic(any ReducedMotionOptionProvider, dataID: AnyHashable) } extension ReducedMotionOption { diff --git a/Sources/Public/Controls/AnimatedControl.swift b/Sources/Public/Controls/AnimatedControl.swift index ae2cdd563f..6d087e7545 100644 --- a/Sources/Public/Controls/AnimatedControl.swift +++ b/Sources/Public/Controls/AnimatedControl.swift @@ -186,7 +186,7 @@ open class AnimatedControl: LottieControlType { } /// Sets a ValueProvider for the specified keypath - public func setValueProvider(_ valueProvider: AnyValueProvider, keypath: AnimationKeypath) { + public func setValueProvider(_ valueProvider: any AnyValueProvider, keypath: AnimationKeypath) { animationView.setValueProvider(valueProvider, keypath: keypath) } diff --git a/Sources/Public/Controls/AnimatedSwitch.swift b/Sources/Public/Controls/AnimatedSwitch.swift index e116e06e31..b1fcee7812 100644 --- a/Sources/Public/Controls/AnimatedSwitch.swift +++ b/Sources/Public/Controls/AnimatedSwitch.swift @@ -221,7 +221,7 @@ open class AnimatedSwitch: AnimatedControl { // MARK: Fileprivate - fileprivate var hapticGenerator: ImpactGenerator + fileprivate var hapticGenerator: any ImpactGenerator fileprivate var _isOn = false { didSet { diff --git a/Sources/Public/DotLottie/DotLottieConfiguration.swift b/Sources/Public/DotLottie/DotLottieConfiguration.swift index 2de4b746c9..d89e55fe22 100644 --- a/Sources/Public/DotLottie/DotLottieConfiguration.swift +++ b/Sources/Public/DotLottie/DotLottieConfiguration.swift @@ -23,7 +23,7 @@ public struct DotLottieConfiguration { public var speed: Double /// Animation Image Provider - public var imageProvider: AnimationImageProvider? { + public var imageProvider: (any AnimationImageProvider)? { dotLottieImageProvider } diff --git a/Sources/Public/DotLottie/DotLottieFileHelpers.swift b/Sources/Public/DotLottie/DotLottieFileHelpers.swift index 018bd59708..606073b1b7 100644 --- a/Sources/Public/DotLottie/DotLottieFileHelpers.swift +++ b/Sources/Public/DotLottie/DotLottieFileHelpers.swift @@ -17,8 +17,8 @@ extension DotLottieFile { /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional. public static func loadedFrom( filepath: String, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache) - -> Result + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache) + -> Result { LottieLogger.shared.assert( !Thread.isMainThread, @@ -56,8 +56,8 @@ extension DotLottieFile { _ name: String, bundle: Bundle = Bundle.main, subdirectory: String? = nil, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache) - -> Result + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache) + -> Result { LottieLogger.shared.assert( !Thread.isMainThread, @@ -97,7 +97,7 @@ extension DotLottieFile { public static func loadedFrom( data: Data, filename: String) - -> Result + -> Result { LottieLogger.shared.assert( !Thread.isMainThread, @@ -122,7 +122,7 @@ extension DotLottieFile { _ name: String, bundle: Bundle = Bundle.main, subdirectory: String? = nil, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache) + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache) async throws -> DotLottieFile { try await withCheckedThrowingContinuation { continuation in @@ -144,9 +144,9 @@ extension DotLottieFile { _ name: String, bundle: Bundle = Bundle.main, subdirectory: String? = nil, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache, + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache, dispatchQueue: DispatchQueue = .dotLottie, - handleResult: @escaping (Result) -> Void) + handleResult: @escaping (Result) -> Void) { dispatchQueue.async { let result = SynchronouslyBlockingCurrentThread.named( @@ -166,7 +166,7 @@ extension DotLottieFile { /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional. public static func loadedFrom( filepath: String, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache) + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache) async throws -> DotLottieFile { try await withCheckedThrowingContinuation { continuation in @@ -183,9 +183,9 @@ extension DotLottieFile { /// - Parameter handleResult: A closure to be called when the file has loaded. public static func loadedFrom( filepath: String, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache, + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache, dispatchQueue: DispatchQueue = .dotLottie, - handleResult: @escaping (Result) -> Void) + handleResult: @escaping (Result) -> Void) { dispatchQueue.async { let result = SynchronouslyBlockingCurrentThread.loadedFrom( @@ -205,7 +205,7 @@ extension DotLottieFile { public static func asset( named name: String, bundle: Bundle = Bundle.main, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache) + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache) async throws -> DotLottieFile { try await withCheckedThrowingContinuation { continuation in @@ -224,9 +224,9 @@ extension DotLottieFile { public static func asset( named name: String, bundle: Bundle = Bundle.main, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache, + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache, dispatchQueue: DispatchQueue = .dotLottie, - handleResult: @escaping (Result) -> Void) + handleResult: @escaping (Result) -> Void) { dispatchQueue.async { /// Create a cache key for the lottie. @@ -270,7 +270,7 @@ extension DotLottieFile { public static func loadedFrom( url: URL, session: URLSession = .shared, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache) + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache) async throws -> DotLottieFile { try await withCheckedThrowingContinuation { continuation in @@ -288,8 +288,8 @@ extension DotLottieFile { public static func loadedFrom( url: URL, session: URLSession = .shared, - dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache, - handleResult: @escaping (Result) -> Void) + dotLottieCache: (any DotLottieCacheProvider)? = DotLottieCache.sharedCache, + handleResult: @escaping (Result) -> Void) { if let dotLottieCache, let lottie = dotLottieCache.file(forKey: url.absoluteString) { handleResult(.success(lottie)) @@ -328,7 +328,7 @@ extension DotLottieFile { data: Data, filename: String, dispatchQueue: DispatchQueue = .dotLottie, - handleResult: @escaping (Result) -> Void) + handleResult: @escaping (Result) -> Void) { dispatchQueue.async { do { diff --git a/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift b/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift index c78846ffe5..29797395aa 100644 --- a/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift +++ b/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift @@ -532,7 +532,7 @@ public final class CompatibleDictionaryTextProvider: NSObject { // MARK: Internal - var textProvider: AnimationKeypathTextProvider? { + var textProvider: (any AnimationKeypathTextProvider)? { DictionaryTextProvider(values) }