diff --git a/Example/Example/AnimationPreviewView.swift b/Example/Example/AnimationPreviewView.swift index eab5512239..2189ac1032 100644 --- a/Example/Example/AnimationPreviewView.swift +++ b/Example/Example/AnimationPreviewView.swift @@ -110,19 +110,19 @@ struct AnimationPreviewView: View { // MARK: Private - /// Used for remote animations only, when more than one URL is provided we loop over the urls every 2 seconds. - private let timer = Timer.publish(every: 2, on: .main, in: .common).autoconnect() - private let urls: [URL] - @State private var animationPlaying = true @State private var sliderValue: AnimationProgressTime = 0 @State private var currentURLIndex: Int - @State private var renderingEngine: RenderingEngineOption = .automatic - @State private var loopMode: LottieLoopMode = .loop + @State private var renderingEngine = RenderingEngineOption.automatic + @State private var loopMode = LottieLoopMode.loop @State private var playFromProgress: AnimationProgressTime = 0 @State private var playToProgress: AnimationProgressTime = 1 @State private var currentRenderingEngine: RenderingEngine? + /// Used for remote animations only, when more than one URL is provided we loop over the urls every 2 seconds. + private let timer = Timer.publish(every: 2, on: .main, in: .common).autoconnect() + private let urls: [URL] + private var playbackMode: LottiePlaybackMode { if animationPlaying { .playing(.fromProgress(playFromProgress, toProgress: playToProgress, loopMode: loopMode)) diff --git a/Package.resolved b/Package.resolved index 20ed813a6b..4b6e290685 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/airbnb/swift", "state" : { - "revision" : "fa3ae574d0b9c93a1655424bd4381044274c5cb4", - "version" : "1.0.7" + "revision" : "c7e833face3f893b8defde66eecb66f24b55ca35", + "version" : "1.0.8" } }, { diff --git a/Sources/Private/CoreAnimation/Animations/CustomPathAnimation.swift b/Sources/Private/CoreAnimation/Animations/CustomPathAnimation.swift index 2171eda517..23b1b42f47 100644 --- a/Sources/Private/CoreAnimation/Animations/CustomPathAnimation.swift +++ b/Sources/Private/CoreAnimation/Animations/CustomPathAnimation.swift @@ -61,8 +61,8 @@ struct BezierPathKeyframe: Interpolatable { /// that can have different counts / timing parameters static func combining( path: KeyframeGroup, - cornerRadius: KeyframeGroup?) throws - -> KeyframeGroup + cornerRadius: KeyframeGroup?) + throws -> KeyframeGroup { guard let cornerRadius, diff --git a/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift b/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift index 92b5e4a18b..cb9b613551 100644 --- a/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift +++ b/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift @@ -23,6 +23,7 @@ extension Stroke: StrokeShapeItem { func copy(width: KeyframeGroup) -> StrokeShapeItem { // Type-erase the copy from `Stroke` to `StrokeShapeItem` + // swiftformat:disable:next redundantProperty let copy: Stroke = copy(width: width) return copy } @@ -35,6 +36,7 @@ extension GradientStroke: StrokeShapeItem { func copy(width: KeyframeGroup) -> StrokeShapeItem { // Type-erase the copy from `GradientStroke` to `StrokeShapeItem` + // swiftformat:disable:next redundantProperty let copy: GradientStroke = copy(width: width) return copy } diff --git a/Sources/Private/CoreAnimation/CoreAnimationLayer.swift b/Sources/Private/CoreAnimation/CoreAnimationLayer.swift index 2cd7f8e4f9..ce1d19b279 100644 --- a/Sources/Private/CoreAnimation/CoreAnimationLayer.swift +++ b/Sources/Private/CoreAnimation/CoreAnimationLayer.swift @@ -594,7 +594,7 @@ extension CALayer { var numberOfSublayersWithTimeRemapping = 0 for sublayer in sublayers ?? [] { - if + if let preCompLayer = sublayer as? PreCompLayer, preCompLayer.preCompLayer.timeRemapping != nil { diff --git a/Sources/Private/CoreAnimation/Layers/GradientRenderLayer.swift b/Sources/Private/CoreAnimation/Layers/GradientRenderLayer.swift index cb2fe4888e..cc1955df4c 100644 --- a/Sources/Private/CoreAnimation/Layers/GradientRenderLayer.swift +++ b/Sources/Private/CoreAnimation/Layers/GradientRenderLayer.swift @@ -25,7 +25,7 @@ final class GradientRenderLayer: CAGradientLayer { /// The reference bounds within this layer that the gradient's /// `startPoint` and `endPoint` should be calculated relative to - var gradientReferenceBounds: CGRect = .zero { + var gradientReferenceBounds = CGRect.zero { didSet { if oldValue != gradientReferenceBounds { updateLayout() diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift index 2cb8653db8..7fafed60ce 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift @@ -116,7 +116,7 @@ struct IndexPathChangeset { inserts.isEmpty && deletes.isEmpty && updates.isEmpty && moves.isEmpty } - static func += (left: inout IndexPathChangeset, right: IndexPathChangeset) { + static func +=(left: inout IndexPathChangeset, right: IndexPathChangeset) { left.inserts += right.inserts left.deletes += right.deletes left.updates += right.updates diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift index 885a4e1a9d..5217fddff8 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift @@ -36,7 +36,7 @@ struct SwiftUIView: MeasuringViewRepresentable, var configurations: [Configuration] = [] - var sizing: SwiftUIMeasurementContainerStrategy = .automatic + var sizing = SwiftUIMeasurementContainerStrategy.automatic // MARK: Private diff --git a/Sources/Private/EmbeddedLibraries/LRUCache/LRUCache.swift b/Sources/Private/EmbeddedLibraries/LRUCache/LRUCache.swift index 771e0b4caa..14b27d176d 100644 --- a/Sources/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +++ b/Sources/Private/EmbeddedLibraries/LRUCache/LRUCache.swift @@ -43,8 +43,8 @@ let LRUCacheMemoryWarningNotification: NSNotification.Name = #else /// Notification that cache should be cleared -let LRUCacheMemoryWarningNotification: NSNotification.Name = - .init("LRUCacheMemoryWarningNotification") +let LRUCacheMemoryWarningNotification = + NSNotification.Name("LRUCacheMemoryWarningNotification") #endif @@ -99,7 +99,7 @@ final class LRUCache { private var values: [Key: Container] = [:] private unowned(unsafe) var head: Container? private unowned(unsafe) var tail: Container? - private let lock: NSLock = .init() + private let lock = NSLock() private var token: AnyObject? private let notificationCenter: NotificationCenter diff --git a/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift b/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift index 34fee19504..fccac2763b 100644 --- a/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +++ b/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift @@ -70,7 +70,8 @@ extension Archive { compressionMethod: CompressionMethod, bufferSize: Int, progress: Progress? = nil, - provider: Provider) throws -> (sizeWritten: Int64, crc32: CRC32) + provider: Provider) + throws -> (sizeWritten: Int64, crc32: CRC32) { var checksum = CRC32(0) var sizeWritten = Int64(0) @@ -266,7 +267,8 @@ extension Archive { size: Int64, bufferSize: Int, progress: Progress? = nil, - provider: Provider) throws -> (sizeWritten: Int64, checksum: CRC32) + provider: Provider) + throws -> (sizeWritten: Int64, checksum: CRC32) { var position: Int64 = 0 var sizeWritten: Int64 = 0 @@ -287,7 +289,8 @@ extension Archive { size: Int64, bufferSize: Int, progress: Progress? = nil, - provider: Provider) throws -> (sizeWritten: Int64, checksum: CRC32) + provider: Provider) + throws -> (sizeWritten: Int64, checksum: CRC32) { var sizeWritten: Int64 = 0 let consumer: Consumer = { data in sizeWritten += Int64(try Data.write(chunk: data, to: self.archiveFile)) } diff --git a/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive.swift b/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive.swift index bb46a7c9b3..0bf1aa8148 100644 --- a/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +++ b/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive.swift @@ -171,21 +171,6 @@ final class Archive: Sequence { var zip64EndOfCentralDirectory: ZIP64EndOfCentralDirectory? var preferredEncoding: String.Encoding? - var totalNumberOfEntriesInCentralDirectory: UInt64 { - zip64EndOfCentralDirectory?.record.totalNumberOfEntriesInCentralDirectory - ?? UInt64(endOfCentralDirectoryRecord.totalNumberOfEntriesInCentralDirectory) - } - - var sizeOfCentralDirectory: UInt64 { - zip64EndOfCentralDirectory?.record.sizeOfCentralDirectory - ?? UInt64(endOfCentralDirectoryRecord.sizeOfCentralDirectory) - } - - var offsetToStartOfCentralDirectory: UInt64 { - zip64EndOfCentralDirectory?.record.offsetToStartOfCentralDirectory - ?? UInt64(endOfCentralDirectoryRecord.offsetToStartOfCentralDirectory) - } - #if swift(>=5.0) var memoryFile: MemoryFile? @@ -221,6 +206,21 @@ final class Archive: Sequence { } #endif + var totalNumberOfEntriesInCentralDirectory: UInt64 { + zip64EndOfCentralDirectory?.record.totalNumberOfEntriesInCentralDirectory + ?? UInt64(endOfCentralDirectoryRecord.totalNumberOfEntriesInCentralDirectory) + } + + var sizeOfCentralDirectory: UInt64 { + zip64EndOfCentralDirectory?.record.sizeOfCentralDirectory + ?? UInt64(endOfCentralDirectoryRecord.sizeOfCentralDirectory) + } + + var offsetToStartOfCentralDirectory: UInt64 { + zip64EndOfCentralDirectory?.record.offsetToStartOfCentralDirectory + ?? UInt64(endOfCentralDirectoryRecord.offsetToStartOfCentralDirectory) + } + // MARK: - Helpers static func scanForEndOfCentralDirectoryRecord(in file: FILEPointer) diff --git a/Sources/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift b/Sources/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift index 94479228f4..4583440d66 100644 --- a/Sources/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +++ b/Sources/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift @@ -38,10 +38,9 @@ extension Data { guard let data = try? readChunk(of: T.size, from: file) else { return nil } - let structure = T(data: data, additionalDataProvider: { additionalDataSize -> Data in + return T(data: data, additionalDataProvider: { additionalDataSize -> Data in try self.readChunk(of: additionalDataSize, from: file) }) - return structure } static func consumePart( diff --git a/Sources/Private/EmbeddedLibraries/ZipFoundation/Entry.swift b/Sources/Private/EmbeddedLibraries/ZipFoundation/Entry.swift index c152192585..6d343f71bf 100644 --- a/Sources/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +++ b/Sources/Private/EmbeddedLibraries/ZipFoundation/Entry.swift @@ -237,7 +237,7 @@ struct Entry: Equatable { return dataOffset } - static func == (lhs: Entry, rhs: Entry) -> Bool { + static func ==(lhs: Entry, rhs: Entry) -> Bool { lhs.path == rhs.path && lhs.localFileHeader.crc32 == rhs.localFileHeader.crc32 && lhs.centralDirectoryStructure.effectiveRelativeOffsetOfLocalHeader diff --git a/Sources/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift b/Sources/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift index e297da7f9c..c365ca23ad 100644 --- a/Sources/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +++ b/Sources/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift @@ -89,8 +89,7 @@ extension FileManager { #endif let timeStamp = TimeInterval(modTimeSpec.tv_sec) + TimeInterval(modTimeSpec.tv_nsec) / 1000000000.0 - let modDate = Date(timeIntervalSince1970: timeStamp) - return modDate + return Date(timeIntervalSince1970: timeStamp) } class func fileSizeForItem(at url: URL) throws -> Int64 { @@ -308,7 +307,7 @@ extension Date { // MARK: Internal var fileModificationDateTime: (UInt16, UInt16) { - (self.fileModificationDate, self.fileModificationTime) + (fileModificationDate, fileModificationTime) } var fileModificationDate: UInt16 { diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift index 41ad736496..68524c8470 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift @@ -31,26 +31,26 @@ class CompositionLayer: CALayer, KeypathSearchable { super.init() anchorPoint = .zero actions = [ - "opacity" : NSNull(), - "transform" : NSNull(), - "bounds" : NSNull(), - "anchorPoint" : NSNull(), - "sublayerTransform" : NSNull(), - "shadowOpacity" : NSNull(), - "shadowOffset" : NSNull(), - "shadowColor" : NSNull(), - "shadowRadius" : NSNull(), + "opacity": NSNull(), + "transform": NSNull(), + "bounds": NSNull(), + "anchorPoint": NSNull(), + "sublayerTransform": NSNull(), + "shadowOpacity": NSNull(), + "shadowOffset": NSNull(), + "shadowColor": NSNull(), + "shadowRadius": NSNull(), ] contentsLayer.anchorPoint = .zero contentsLayer.bounds = CGRect(origin: .zero, size: size) contentsLayer.actions = [ - "opacity" : NSNull(), - "transform" : NSNull(), - "bounds" : NSNull(), - "anchorPoint" : NSNull(), - "sublayerTransform" : NSNull(), - "hidden" : NSNull(), + "opacity": NSNull(), + "transform": NSNull(), + "bounds": NSNull(), + "anchorPoint": NSNull(), + "sublayerTransform": NSNull(), + "hidden": NSNull(), ] compositingFilter = layer.blendMode.filterName addSublayer(contentsLayer) diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift index 708b8a14be..a214ae3bb9 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift @@ -46,7 +46,7 @@ final class ImageCompositionLayer: CompositionLayer { } } - var imageContentsGravity: CALayerContentsGravity = .resize { + var imageContentsGravity = CALayerContentsGravity.resize { didSet { contentsLayer.contentsGravity = imageContentsGravity } diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift index bfab6ea50c..5e40660832 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift @@ -108,7 +108,7 @@ private class MaskLayer: CALayer { : .rgb(0, 1, 0) maskLayer.fillRule = CAShapeLayerFillRule.evenOdd actions = [ - "opacity" : NSNull(), + "opacity": NSNull(), ] } @@ -168,9 +168,9 @@ private class MaskNodeProperties: NodePropertyMap { shape = NodeProperty(provider: KeyframeInterpolator(keyframes: mask.shape.keyframes)) expansion = NodeProperty(provider: KeyframeInterpolator(keyframes: mask.expansion.keyframes)) propertyMap = [ - PropertyName.opacity.rawValue : opacity, - "Shape" : shape, - "Expansion" : expansion, + PropertyName.opacity.rawValue: opacity, + "Shape": shape, + "Expansion": expansion, ] properties = Array(propertyMap.values) } diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift index 44d6a394fb..0873f89438 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift @@ -107,7 +107,7 @@ final class PreCompositionLayer: CompositionLayer { guard let remappingNode else { return super.keypathProperties } - return ["Time Remap" : remappingNode] + return ["Time Remap": remappingNode] } 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..a10aec9932 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift @@ -45,7 +45,7 @@ final class SolidCompositionLayer: CompositionLayer { override var keypathProperties: [String: AnyNodeProperty] { guard let colorProperty else { return super.keypathProperties } - return [PropertyName.color.rawValue : colorProperty] + return [PropertyName.color.rawValue: colorProperty] } override func displayContentsWithFrame(frame: CGFloat, forceUpdates _: Bool) { diff --git a/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift b/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift index 9311603023..b56636247d 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift @@ -22,7 +22,7 @@ extension [LayerModel] { -> [CompositionLayer] { var compositionLayers = [CompositionLayer]() - var layerMap = [Int : CompositionLayer]() + var layerMap = [Int: CompositionLayer]() /// Organize the assets into a dictionary of [ID : ImageAsset] var childLayers = [LayerModel]() diff --git a/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift b/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift index 5d72f5cfa9..f988b3ac08 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift @@ -217,43 +217,6 @@ final class CoreTextRenderLayer: CALayer { private var strokeFrameSetter: CTFramesetter? private var needsContentUpdate = false - /// Draws Debug colors for the font alignment. - private func drawDebug(_ ctx: CGContext) { - if let font { - let ascent = CTFontGetAscent(font) - let descent = CTFontGetDescent(font) - let capHeight = CTFontGetCapHeight(font) - let leading = CTFontGetLeading(font) - - // Ascent Red - ctx.setFillColor(CGColor(srgbRed: 1, green: 0, blue: 0, alpha: 0.5)) - ctx.fill(CGRect(x: 0, y: 0, width: drawingRect.width, height: ascent)) - - // Descent Blue - ctx.setFillColor(CGColor(srgbRed: 0, green: 0, blue: 1, alpha: 0.5)) - ctx.fill(CGRect(x: 0, y: ascent, width: drawingRect.width, height: descent)) - - // Leading Yellow - ctx.setFillColor(CGColor(srgbRed: 1, green: 1, blue: 0, alpha: 0.5)) - ctx.fill(CGRect(x: 0, y: ascent + descent, width: drawingRect.width, height: leading)) - - // Cap height Green - ctx.setFillColor(CGColor(srgbRed: 0, green: 1, blue: 0, alpha: 0.5)) - ctx.fill(CGRect(x: 0, y: ascent - capHeight, width: drawingRect.width, height: capHeight)) - - if drawingRect.height - ascent + descent + leading > 0 { - // Remainder - ctx.setFillColor(CGColor(srgbRed: 0, green: 1, blue: 1, alpha: 0.5)) - ctx - .fill(CGRect( - x: 0, - y: ascent + descent + leading, - width: drawingRect.width, - height: drawingRect.height - ascent + descent + leading)) - } - } - } - private func updateTextContent() { guard needsContentUpdate else { return } needsContentUpdate = false diff --git a/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift b/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift index fc5d2dae90..efddc5abc1 100644 --- a/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +++ b/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift @@ -22,13 +22,13 @@ final class LayerTransformProperties: NodePropertyMap, KeypathSearchable { opacity = NodeProperty(provider: KeyframeInterpolator(keyframes: transform.opacity.keyframes)) var propertyMap: [String: AnyNodeProperty] = [ - "Anchor Point" : anchor, - PropertyName.scale.rawValue : scale, + "Anchor Point": anchor, + PropertyName.scale.rawValue: scale, PropertyName.rotation.rawValue: rotationZ, - "Rotation X" : rotationX, - "Rotation Y" : rotationY, - "Rotation Z" : rotationZ, - PropertyName.opacity.rawValue : opacity, + "Rotation X": rotationX, + "Rotation Y": rotationY, + "Rotation Z": rotationZ, + PropertyName.opacity.rawValue: opacity, ] if diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift index 67be54b5cf..40efea7400 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift @@ -17,7 +17,7 @@ final class RoundedCornersProperties: NodePropertyMap, KeypathSearchable { init(roundedCorners: RoundedCorners) { keypathName = roundedCorners.name radius = NodeProperty(provider: KeyframeInterpolator(keyframes: roundedCorners.radius.keyframes)) - keypathProperties = ["Radius" : radius] + keypathProperties = ["Radius": radius] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift index 13000dc332..ae7de137d1 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift @@ -21,9 +21,9 @@ final class TrimPathProperties: NodePropertyMap, KeypathSearchable { offset = NodeProperty(provider: KeyframeInterpolator(keyframes: trim.offset.keyframes)) type = trim.trimType keypathProperties = [ - "Start" : start, - "End" : end, - "Offset" : offset, + "Start": start, + "End": end, + "Offset": offset, ] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift index c858909a9d..cfdc97ebfb 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift @@ -45,7 +45,7 @@ final class FillRenderer: PassThroughOutputNode, Renderable { } } - var fillRule: FillRule = .none { + var fillRule = FillRule.none { didSet { hasUpdate = true } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift index d011ad61d3..1398b611a2 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift @@ -11,7 +11,7 @@ import QuartzCore private final class GradientFillLayer: CALayer { - var start: CGPoint = .zero { + var start = CGPoint.zero { didSet { setNeedsDisplay() } @@ -29,13 +29,13 @@ private final class GradientFillLayer: CALayer { } } - var end: CGPoint = .zero { + var end = CGPoint.zero { didSet { setNeedsDisplay() } } - var type: GradientType = .none { + var type = GradientType.none { didSet { setNeedsDisplay() } @@ -144,15 +144,15 @@ final class GradientFillRenderer: PassThroughOutputNode, Renderable { gradientLayer.mask = maskLayer maskLayer.actions = [ - "startPoint" : NSNull(), - "endPoint" : NSNull(), - "opacity" : NSNull(), - "locations" : NSNull(), - "colors" : NSNull(), - "bounds" : NSNull(), - "anchorPoint" : NSNull(), - "isRadial" : NSNull(), - "path" : NSNull(), + "startPoint": NSNull(), + "endPoint": NSNull(), + "opacity": NSNull(), + "locations": NSNull(), + "colors": NSNull(), + "bounds": NSNull(), + "anchorPoint": NSNull(), + "isRadial": NSNull(), + "path": NSNull(), ] gradientLayer.actions = maskLayer.actions } @@ -161,7 +161,7 @@ final class GradientFillRenderer: PassThroughOutputNode, Renderable { var shouldRenderInContext = false - var start: CGPoint = .zero { + var start = CGPoint.zero { didSet { hasUpdate = true } @@ -179,7 +179,7 @@ final class GradientFillRenderer: PassThroughOutputNode, Renderable { } } - var end: CGPoint = .zero { + var end = CGPoint.zero { didSet { hasUpdate = true } @@ -191,7 +191,7 @@ final class GradientFillRenderer: PassThroughOutputNode, Renderable { } } - var type: GradientType = .none { + var type = GradientType.none { didSet { hasUpdate = true } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift index 953548bd54..a73ca86c1b 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift @@ -12,7 +12,7 @@ final class LegacyGradientFillRenderer: PassThroughOutputNode, Renderable { var shouldRenderInContext = true - var start: CGPoint = .zero { + var start = CGPoint.zero { didSet { hasUpdate = true } @@ -30,7 +30,7 @@ final class LegacyGradientFillRenderer: PassThroughOutputNode, Renderable { } } - var end: CGPoint = .zero { + var end = CGPoint.zero { didSet { hasUpdate = true } @@ -42,7 +42,7 @@ final class LegacyGradientFillRenderer: PassThroughOutputNode, Renderable { } } - var type: GradientType = .none { + var type = GradientType.none { didSet { hasUpdate = true } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift index 2e400e43e5..8f0b4e60dc 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift @@ -94,13 +94,13 @@ final class StrokeRenderer: PassThroughOutputNode, Renderable { } } - var lineCap: LineCap = .none { + var lineCap = LineCap.none { didSet { hasUpdate = true } } - var lineJoin: LineJoin = .none { + var lineJoin = LineJoin.none { didSet { hasUpdate = true } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift index a5c40e6b63..2986a23963 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift @@ -20,8 +20,8 @@ final class EllipseNodeProperties: NodePropertyMap, KeypathSearchable { position = NodeProperty(provider: KeyframeInterpolator(keyframes: ellipse.position.keyframes)) size = NodeProperty(provider: KeyframeInterpolator(keyframes: ellipse.size.keyframes)) keypathProperties = [ - PropertyName.position.rawValue : position, - "Size" : size, + PropertyName.position.rawValue: position, + "Size": size, ] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift index 49e502b9c4..2a4210251f 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift @@ -23,11 +23,11 @@ final class PolygonNodeProperties: NodePropertyMap, KeypathSearchable { rotation = NodeProperty(provider: KeyframeInterpolator(keyframes: star.rotation.keyframes)) points = NodeProperty(provider: KeyframeInterpolator(keyframes: star.points.keyframes)) keypathProperties = [ - PropertyName.position.rawValue : position, - "Outer Radius" : outerRadius, - "Outer Roundedness" : outerRoundedness, - PropertyName.rotation.rawValue : rotation, - "Points" : points, + PropertyName.position.rawValue: position, + "Outer Radius": outerRadius, + "Outer Roundedness": outerRoundedness, + PropertyName.rotation.rawValue: rotation, + "Points": points, ] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift index 4c93f002b5..951a9bee32 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift @@ -22,9 +22,9 @@ final class RectNodeProperties: NodePropertyMap, KeypathSearchable { cornerRadius = NodeProperty(provider: KeyframeInterpolator(keyframes: rectangle.cornerRadius.keyframes)) keypathProperties = [ - PropertyName.position.rawValue : position, - "Size" : size, - "Roundness" : cornerRadius, + PropertyName.position.rawValue: position, + "Size": size, + "Roundness": cornerRadius, ] properties = Array(keypathProperties.values) @@ -102,7 +102,7 @@ extension BezierPath { -> BezierPath { let size = inputSize * 0.5 - let radius = min(min(cornerRadius, size.width) , size.height) + let radius = min(min(cornerRadius, size.width), size.height) var bezierPath = BezierPath() let points: [CurveVertex] diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift index 7bc7d9055d..a1ff02501a 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift @@ -18,7 +18,7 @@ final class ShapeNodeProperties: NodePropertyMap, KeypathSearchable { keypathName = shape.name path = NodeProperty(provider: KeyframeInterpolator(keyframes: shape.path.keyframes)) keypathProperties = [ - "Path" : path, + "Path": path, ] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift index bf1753108f..edb5df4dae 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift @@ -33,13 +33,13 @@ final class StarNodeProperties: NodePropertyMap, KeypathSearchable { rotation = NodeProperty(provider: KeyframeInterpolator(keyframes: star.rotation.keyframes)) points = NodeProperty(provider: KeyframeInterpolator(keyframes: star.points.keyframes)) keypathProperties = [ - PropertyName.position.rawValue : position, - "Outer Radius" : outerRadius, - "Outer Roundedness" : outerRoundedness, - "Inner Radius" : innerRadius, - "Inner Roundedness" : innerRoundedness, - PropertyName.rotation.rawValue : rotation, - "Points" : points, + PropertyName.position.rawValue: position, + "Outer Radius": outerRadius, + "Outer Roundedness": outerRoundedness, + "Inner Radius": innerRadius, + "Inner Roundedness": innerRoundedness, + PropertyName.rotation.rawValue: rotation, + "Points": points, ] properties = Array(keypathProperties.values) } @@ -134,7 +134,7 @@ extension BezierPath { let outerRoundedness = inoutOuterRoundedness * 0.01 let innerRoundedness = inputInnerRoundedness * 0.01 - var point: CGPoint = .zero + var point = CGPoint.zero var partialPointRadius: CGFloat = 0 if partialPointAmount != 0 { diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift index ddda7a3cc7..9b9ddd884c 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift @@ -37,16 +37,16 @@ final class GroupNodeProperties: NodePropertyMap, KeypathSearchable { skewAxis = NodeProperty(provider: SingleValueProvider(LottieVector1D(0))) } keypathProperties = [ - "Anchor Point" : anchor, - PropertyName.position.rawValue : position, - PropertyName.scale.rawValue : scale, - PropertyName.rotation.rawValue : rotationZ, - "Rotation X" : rotationX, - "Rotation Y" : rotationY, - "Rotation Z" : rotationZ, - PropertyName.opacity.rawValue : opacity, - "Skew" : skew, - "Skew Axis" : skewAxis, + "Anchor Point": anchor, + PropertyName.position.rawValue: position, + PropertyName.scale.rawValue: scale, + PropertyName.rotation.rawValue: rotationZ, + "Rotation X": rotationX, + "Rotation Y": rotationY, + "Rotation Z": rotationZ, + PropertyName.opacity.rawValue: opacity, + "Skew": skew, + "Skew Axis": skewAxis, ] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift index 1b079b084a..e99c92ca04 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift @@ -20,8 +20,8 @@ final class FillNodeProperties: NodePropertyMap, KeypathSearchable { opacity = NodeProperty(provider: KeyframeInterpolator(keyframes: fill.opacity.keyframes)) type = fill.fillRule keypathProperties = [ - PropertyName.opacity.rawValue : opacity, - PropertyName.color.rawValue : color, + PropertyName.opacity.rawValue: opacity, + PropertyName.color.rawValue: color, ] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift index 97e37ef614..964856a0b2 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift @@ -24,10 +24,10 @@ final class GradientFillProperties: NodePropertyMap, KeypathSearchable { numberOfColors = gradientfill.numberOfColors fillRule = gradientfill.fillRule keypathProperties = [ - PropertyName.opacity.rawValue : opacity, - "Start Point" : startPoint, - "End Point" : endPoint, - PropertyName.gradientColors.rawValue : colors, + PropertyName.opacity.rawValue: opacity, + "Start Point": startPoint, + "End Point": endPoint, + PropertyName.gradientColors.rawValue: colors, ] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift index 62f0dfe6c7..e7a1db0dbd 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift @@ -44,13 +44,13 @@ final class GradientStrokeProperties: NodePropertyMap, KeypathSearchable { dashPhase = NodeProperty(provider: SingleValueProvider(LottieVector1D(0))) } keypathProperties = [ - PropertyName.opacity.rawValue : opacity, - "Start Point" : startPoint, - "End Point" : endPoint, - PropertyName.gradientColors.rawValue : colors, - PropertyName.strokeWidth.rawValue : width, - "Dashes" : dashPattern, - "Dash Phase" : dashPhase, + PropertyName.opacity.rawValue: opacity, + "Start Point": startPoint, + "End Point": endPoint, + PropertyName.gradientColors.rawValue: colors, + PropertyName.strokeWidth.rawValue: width, + "Dashes": dashPattern, + "Dash Phase": dashPhase, ] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift index ae2aed4818..1bbbb85061 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift @@ -36,11 +36,11 @@ final class StrokeNodeProperties: NodePropertyMap, KeypathSearchable { dashPhase = NodeProperty(provider: SingleValueProvider(LottieVector1D(0))) } keypathProperties = [ - PropertyName.opacity.rawValue : opacity, - PropertyName.color.rawValue : color, - PropertyName.strokeWidth.rawValue : width, - "Dashes" : dashPattern, - "Dash Phase" : dashPhase, + PropertyName.opacity.rawValue: opacity, + PropertyName.color.rawValue: color, + PropertyName.strokeWidth.rawValue: width, + "Dashes": dashPattern, + "Dash Phase": dashPhase, ] properties = Array(keypathProperties.values) } diff --git a/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift b/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift index dd9e0685b0..d2c5076e26 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: AnyNodeProperty]() if let keyframeGroup = textAnimator.anchor { anchor = NodeProperty(provider: KeyframeInterpolator(keyframes: keyframeGroup.keyframes)) diff --git a/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift b/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift index fbe177762c..bbe7583950 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift @@ -15,12 +15,12 @@ class ShapeContainerLayer: CALayer { override init() { super.init() actions = [ - "position" : NSNull(), - "bounds" : NSNull(), - "anchorPoint" : NSNull(), - "transform" : NSNull(), - "opacity" : NSNull(), - "hidden" : NSNull(), + "position": NSNull(), + "bounds": NSNull(), + "anchorPoint": NSNull(), + "transform": NSNull(), + "opacity": NSNull(), + "hidden": NSNull(), ] } diff --git a/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift b/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift index bd2eac2c5f..3aa5b06639 100644 --- a/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +++ b/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift @@ -17,26 +17,26 @@ final class ShapeRenderLayer: ShapeContainerLayer { super.init() anchorPoint = .zero actions = [ - "position" : NSNull(), - "bounds" : NSNull(), - "anchorPoint" : NSNull(), - "path" : NSNull(), - "transform" : NSNull(), - "opacity" : NSNull(), - "hidden" : NSNull(), + "position": NSNull(), + "bounds": NSNull(), + "anchorPoint": NSNull(), + "path": NSNull(), + "transform": NSNull(), + "opacity": NSNull(), + "hidden": NSNull(), ] shapeLayer.actions = [ - "position" : NSNull(), - "bounds" : NSNull(), - "anchorPoint" : NSNull(), - "path" : NSNull(), - "fillColor" : NSNull(), - "strokeColor" : NSNull(), - "lineWidth" : NSNull(), - "miterLimit" : NSNull(), - "lineDashPhase" : NSNull(), + "position": NSNull(), + "bounds": NSNull(), + "anchorPoint": NSNull(), + "path": NSNull(), + "fillColor": NSNull(), + "strokeColor": NSNull(), + "lineWidth": NSNull(), + "miterLimit": NSNull(), + "lineDashPhase": NSNull(), "opacity": NSNull(), - "hidden" : NSNull(), + "hidden": NSNull(), ] addSublayer(shapeLayer) diff --git a/Sources/Private/Model/Assets/Asset.swift b/Sources/Private/Model/Assets/Asset.swift index 514f8226c4..46d30094cc 100644 --- a/Sources/Private/Model/Assets/Asset.swift +++ b/Sources/Private/Model/Assets/Asset.swift @@ -42,7 +42,7 @@ public class Asset: Codable, DictionaryInitializable { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// Since `Asset` isn't `final`, we have to use `@unchecked Sendable` instead of `Sendable.` /// All `Asset` subclasses are immutable `Sendable` values. diff --git a/Sources/Private/Model/Assets/AssetLibrary.swift b/Sources/Private/Model/Assets/AssetLibrary.swift index 7d00b0b7e1..ee3c13185c 100644 --- a/Sources/Private/Model/Assets/AssetLibrary.swift +++ b/Sources/Private/Model/Assets/AssetLibrary.swift @@ -13,10 +13,10 @@ final class AssetLibrary: Codable, AnyInitializable, Sendable { var container = try decoder.unkeyedContainer() var containerForKeys = container - var decodedAssets = [String : Asset]() + var decodedAssets = [String: Asset]() - var imageAssets = [String : ImageAsset]() - var precompAssets = [String : PrecompAsset]() + var imageAssets = [String: ImageAsset]() + var precompAssets = [String: PrecompAsset]() while !container.isAtEnd, @@ -42,9 +42,9 @@ final class AssetLibrary: Codable, AnyInitializable, Sendable { guard let dictionaries = value as? [[String: Any]] else { throw InitializableError.invalidInput() } - var decodedAssets = [String : Asset]() - var imageAssets = [String : ImageAsset]() - var precompAssets = [String : PrecompAsset]() + var decodedAssets = [String: Asset]() + var imageAssets = [String: ImageAsset]() + var precompAssets = [String: PrecompAsset]() for dictionary in dictionaries { if dictionary[PrecompAsset.CodingKeys.layers.rawValue] != nil { let asset = try PrecompAsset(dictionary: dictionary) diff --git a/Sources/Private/Model/Assets/PrecompAsset.swift b/Sources/Private/Model/Assets/PrecompAsset.swift index 6240fbb230..2e6b14afab 100644 --- a/Sources/Private/Model/Assets/PrecompAsset.swift +++ b/Sources/Private/Model/Assets/PrecompAsset.swift @@ -39,7 +39,7 @@ final class PrecompAsset: Asset { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `PrecompAsset` inherits `@unchecked Sendable` from `Asset` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/Keyframes/KeyframeGroup.swift b/Sources/Private/Model/Keyframes/KeyframeGroup.swift index 5da4c4c1b0..fe51f50f15 100644 --- a/Sources/Private/Model/Keyframes/KeyframeGroup.swift +++ b/Sources/Private/Model/Keyframes/KeyframeGroup.swift @@ -190,7 +190,7 @@ extension KeyframeGroup: DictionaryInitializable where T: AnyInitializable { // MARK: Equatable extension KeyframeGroup: Equatable where T: Equatable { - static func == (_ lhs: KeyframeGroup, _ rhs: KeyframeGroup) -> Bool { + static func ==(_ lhs: KeyframeGroup, _ rhs: KeyframeGroup) -> Bool { lhs.keyframes == rhs.keyframes } } diff --git a/Sources/Private/Model/LayerEffects/DropShadowEffect.swift b/Sources/Private/Model/LayerEffects/DropShadowEffect.swift index 218129df61..9695d767a3 100644 --- a/Sources/Private/Model/LayerEffects/DropShadowEffect.swift +++ b/Sources/Private/Model/LayerEffects/DropShadowEffect.swift @@ -44,7 +44,7 @@ final class DropShadowEffect: LayerEffect { } -// MARK: Sendable +// MARK: @unchecked Sendable /// `DropShadowEffect` inherits `@unchecked Sendable` from `LayerEffect` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift b/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift index 3efaae427b..b175136d15 100644 --- a/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +++ b/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift @@ -37,7 +37,7 @@ final class ColorEffectValue: EffectValue { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `ColorEffectValue` inherits `@unchecked Sendable` from `EffectValue` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift b/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift index 4f154f52c9..ef39c0d68b 100644 --- a/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift +++ b/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift @@ -18,7 +18,7 @@ enum EffectValueType: Int, Codable, Sendable { // MARK: ClassFamily extension EffectValueType: ClassFamily { - static var discriminator: Discriminator = .type + static var discriminator = Discriminator.type func getType() -> AnyObject.Type { switch self { diff --git a/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift b/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift index 1bf8d52538..99ad8dcf2b 100644 --- a/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +++ b/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift @@ -37,7 +37,7 @@ final class Vector1DEffectValue: EffectValue { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Vector1DEffectValue` inherits `@unchecked Sendable` from `EffectValue` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/LayerEffects/LayerEffect.swift b/Sources/Private/Model/LayerEffects/LayerEffect.swift index 654acfc2fc..c6c5d7f909 100644 --- a/Sources/Private/Model/LayerEffects/LayerEffect.swift +++ b/Sources/Private/Model/LayerEffects/LayerEffect.swift @@ -16,7 +16,7 @@ enum LayerEffectType: Int, Codable, Sendable { // MARK: ClassFamily extension LayerEffectType: ClassFamily { - static var discriminator: Discriminator = .type + static var discriminator = Discriminator.type func getType() -> AnyObject.Type { switch self { diff --git a/Sources/Private/Model/LayerStyles/DropShadowStyle.swift b/Sources/Private/Model/LayerStyles/DropShadowStyle.swift index 3f905b759d..c718959bc5 100644 --- a/Sources/Private/Model/LayerStyles/DropShadowStyle.swift +++ b/Sources/Private/Model/LayerStyles/DropShadowStyle.swift @@ -71,7 +71,7 @@ final class DropShadowStyle: LayerStyle { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `DropShadowStyle` inherits `@unchecked Sendable` from `LayerStyle` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/LayerStyles/LayerStyle.swift b/Sources/Private/Model/LayerStyles/LayerStyle.swift index 70d28a5d5a..3f8318f85c 100644 --- a/Sources/Private/Model/LayerStyles/LayerStyle.swift +++ b/Sources/Private/Model/LayerStyles/LayerStyle.swift @@ -15,7 +15,7 @@ enum LayerStyleType: Int, Codable, Sendable { // MARK: ClassFamily extension LayerStyleType: ClassFamily { - static var discriminator: Discriminator = .type + static var discriminator = Discriminator.type func getType() -> AnyObject.Type { switch self { diff --git a/Sources/Private/Model/Layers/ImageLayerModel.swift b/Sources/Private/Model/Layers/ImageLayerModel.swift index 791d3ca555..d4c5e59be4 100644 --- a/Sources/Private/Model/Layers/ImageLayerModel.swift +++ b/Sources/Private/Model/Layers/ImageLayerModel.swift @@ -41,7 +41,7 @@ final class ImageLayerModel: LayerModel { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `ImageLayerModel` inherits `@unchecked Sendable` from `LayerModel` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/Layers/LayerModel.swift b/Sources/Private/Model/Layers/LayerModel.swift index e2e3e38888..c1a56102e3 100644 --- a/Sources/Private/Model/Layers/LayerModel.swift +++ b/Sources/Private/Model/Layers/LayerModel.swift @@ -9,7 +9,7 @@ /// Used for mapping a heterogeneous list to classes for parsing. extension LayerType: ClassFamily { - static var discriminator: Discriminator = .type + static var discriminator = Discriminator.type func getType() -> AnyObject.Type { switch self { diff --git a/Sources/Private/Model/Layers/PreCompLayerModel.swift b/Sources/Private/Model/Layers/PreCompLayerModel.swift index 25bb5d0da4..baefb4b96a 100644 --- a/Sources/Private/Model/Layers/PreCompLayerModel.swift +++ b/Sources/Private/Model/Layers/PreCompLayerModel.swift @@ -66,7 +66,7 @@ final class PreCompLayerModel: LayerModel { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `PreCompLayerModel` inherits `@unchecked Sendable` from `LayerModel` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/Layers/ShapeLayerModel.swift b/Sources/Private/Model/Layers/ShapeLayerModel.swift index b9fe661035..0f72c59dbe 100644 --- a/Sources/Private/Model/Layers/ShapeLayerModel.swift +++ b/Sources/Private/Model/Layers/ShapeLayerModel.swift @@ -42,7 +42,7 @@ final class ShapeLayerModel: LayerModel { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `ShapeLayerModel` inherits `@unchecked Sendable` from `LayerModel` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/Layers/SolidLayerModel.swift b/Sources/Private/Model/Layers/SolidLayerModel.swift index ba1d3fb2d1..677cd71855 100644 --- a/Sources/Private/Model/Layers/SolidLayerModel.swift +++ b/Sources/Private/Model/Layers/SolidLayerModel.swift @@ -55,7 +55,7 @@ final class SolidLayerModel: LayerModel { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `SolidLayerModel` inherits `@unchecked Sendable` from `LayerModel` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/Layers/TextLayerModel.swift b/Sources/Private/Model/Layers/TextLayerModel.swift index 1de3d75280..3ec716ced5 100644 --- a/Sources/Private/Model/Layers/TextLayerModel.swift +++ b/Sources/Private/Model/Layers/TextLayerModel.swift @@ -57,7 +57,7 @@ final class TextLayerModel: LayerModel { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `TextLayerModel` inherits `@unchecked Sendable` from `LayerModel` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Ellipse.swift b/Sources/Private/Model/ShapeItems/Ellipse.swift index 5a2c825449..dbf863e042 100644 --- a/Sources/Private/Model/ShapeItems/Ellipse.swift +++ b/Sources/Private/Model/ShapeItems/Ellipse.swift @@ -71,7 +71,7 @@ final class Ellipse: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Ellipse` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Fill.swift b/Sources/Private/Model/ShapeItems/Fill.swift index 5e57a1285f..94dc6e81ed 100644 --- a/Sources/Private/Model/ShapeItems/Fill.swift +++ b/Sources/Private/Model/ShapeItems/Fill.swift @@ -71,7 +71,7 @@ final class Fill: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Fill` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/GradientFill.swift b/Sources/Private/Model/ShapeItems/GradientFill.swift index 9171b5757c..bfd4ded293 100644 --- a/Sources/Private/Model/ShapeItems/GradientFill.swift +++ b/Sources/Private/Model/ShapeItems/GradientFill.swift @@ -134,7 +134,7 @@ final class GradientFill: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `GradientFill` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/GradientStroke.swift b/Sources/Private/Model/ShapeItems/GradientStroke.swift index 9cc6de6b38..be4730bb00 100644 --- a/Sources/Private/Model/ShapeItems/GradientStroke.swift +++ b/Sources/Private/Model/ShapeItems/GradientStroke.swift @@ -235,7 +235,7 @@ final class GradientStroke: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `GradientStroke` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Group.swift b/Sources/Private/Model/ShapeItems/Group.swift index 271df6afce..aba43c07e7 100644 --- a/Sources/Private/Model/ShapeItems/Group.swift +++ b/Sources/Private/Model/ShapeItems/Group.swift @@ -47,7 +47,7 @@ final class Group: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Group` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Merge.swift b/Sources/Private/Model/ShapeItems/Merge.swift index 8120e7bf22..b89639ebd5 100644 --- a/Sources/Private/Model/ShapeItems/Merge.swift +++ b/Sources/Private/Model/ShapeItems/Merge.swift @@ -55,7 +55,7 @@ final class Merge: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Merge` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Rectangle.swift b/Sources/Private/Model/ShapeItems/Rectangle.swift index 6616a9ea02..f119c2bd63 100644 --- a/Sources/Private/Model/ShapeItems/Rectangle.swift +++ b/Sources/Private/Model/ShapeItems/Rectangle.swift @@ -71,7 +71,7 @@ final class Rectangle: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Rectangle` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Repeater.swift b/Sources/Private/Model/ShapeItems/Repeater.swift index fecca0c1e5..abd1143c61 100644 --- a/Sources/Private/Model/ShapeItems/Repeater.swift +++ b/Sources/Private/Model/ShapeItems/Repeater.swift @@ -173,7 +173,7 @@ final class Repeater: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Repeater` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/RoundedCorners.swift b/Sources/Private/Model/ShapeItems/RoundedCorners.swift index b602ad810e..fa274ef25f 100644 --- a/Sources/Private/Model/ShapeItems/RoundedCorners.swift +++ b/Sources/Private/Model/ShapeItems/RoundedCorners.swift @@ -44,7 +44,7 @@ final class RoundedCorners: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `RoundedCorners` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Shape.swift b/Sources/Private/Model/ShapeItems/Shape.swift index 44682324ae..9301f8bcdd 100644 --- a/Sources/Private/Model/ShapeItems/Shape.swift +++ b/Sources/Private/Model/ShapeItems/Shape.swift @@ -55,7 +55,7 @@ final class Shape: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Shape` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/ShapeItem.swift b/Sources/Private/Model/ShapeItems/ShapeItem.swift index f058100600..688de7860e 100644 --- a/Sources/Private/Model/ShapeItems/ShapeItem.swift +++ b/Sources/Private/Model/ShapeItems/ShapeItem.swift @@ -33,7 +33,7 @@ enum ShapeType: String, Codable, Sendable { extension ShapeType: ClassFamily { - static var discriminator: Discriminator = .type + static var discriminator = Discriminator.type func getType() -> AnyObject.Type { switch self { diff --git a/Sources/Private/Model/ShapeItems/ShapeTransform.swift b/Sources/Private/Model/ShapeItems/ShapeTransform.swift index f077b820b0..0b5e1d5fab 100644 --- a/Sources/Private/Model/ShapeItems/ShapeTransform.swift +++ b/Sources/Private/Model/ShapeItems/ShapeTransform.swift @@ -194,7 +194,7 @@ final class ShapeTransform: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `ShapeTransform` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Star.swift b/Sources/Private/Model/ShapeItems/Star.swift index a75c5a73d3..3f82718b1d 100644 --- a/Sources/Private/Model/ShapeItems/Star.swift +++ b/Sources/Private/Model/ShapeItems/Star.swift @@ -128,7 +128,7 @@ final class Star: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Star` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Stroke.swift b/Sources/Private/Model/ShapeItems/Stroke.swift index 653b3d3513..4a272a45e8 100644 --- a/Sources/Private/Model/ShapeItems/Stroke.swift +++ b/Sources/Private/Model/ShapeItems/Stroke.swift @@ -135,7 +135,7 @@ final class Stroke: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Stroke` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Model/ShapeItems/Trim.swift b/Sources/Private/Model/ShapeItems/Trim.swift index d327f52676..188d823065 100644 --- a/Sources/Private/Model/ShapeItems/Trim.swift +++ b/Sources/Private/Model/ShapeItems/Trim.swift @@ -82,7 +82,7 @@ final class Trim: ShapeItem { } } -// MARK: Sendable +// MARK: @unchecked Sendable /// `Trim` inherits `@unchecked Sendable` from `ShapeItem` and /// we need to restate that here to avoid a warning in Xcode 16 diff --git a/Sources/Private/Utility/Extensions/MathKit.swift b/Sources/Private/Utility/Extensions/MathKit.swift index 12db23e71c..73df13f74f 100644 --- a/Sources/Private/Utility/Extensions/MathKit.swift +++ b/Sources/Private/Utility/Extensions/MathKit.swift @@ -264,12 +264,12 @@ extension CGPoint { } /// Operator convenience to divide points with / - static func / (lhs: CGPoint, rhs: CGFloat) -> CGPoint { + static func /(lhs: CGPoint, rhs: CGFloat) -> CGPoint { CGPoint(x: lhs.x / rhs, y: lhs.y / rhs) } /// Operator convenience to multiply points with * - static func * (lhs: CGPoint, rhs: CGFloat) -> CGPoint { + static func *(lhs: CGPoint, rhs: CGFloat) -> CGPoint { CGPoint(x: lhs.x * rhs, y: lhs.y * rhs) } @@ -414,8 +414,7 @@ extension CGPoint { let c = inTangent.interpolate(to: to, amount: amount) let d = a.interpolate(to: b, amount: amount) let e = b.interpolate(to: c, amount: amount) - let f = d.interpolate(to: e, amount: amount) - return f + return d.interpolate(to: e, amount: amount) } func colinear(_ a: CGPoint, _ b: CGPoint) -> Bool { diff --git a/Sources/Private/Utility/Helpers/AnimationContext.swift b/Sources/Private/Utility/Helpers/AnimationContext.swift index 8d6cba046c..2495a3db76 100644 --- a/Sources/Private/Utility/Helpers/AnimationContext.swift +++ b/Sources/Private/Utility/Helpers/AnimationContext.swift @@ -39,7 +39,7 @@ extension AnimationContext: Equatable { /// Whether or not the two given `AnimationContext`s are functionally equivalent /// - This checks whether or not a completion handler was provided, /// but does not check whether or not the two completion handlers are equivalent. - static func == (_ lhs: AnimationContext, _ rhs: AnimationContext) -> Bool { + static func ==(_ lhs: AnimationContext, _ rhs: AnimationContext) -> Bool { lhs.playTo == rhs.playTo && lhs.playFrom == rhs.playFrom && (lhs.closure.completionBlock == nil) == (rhs.closure.completionBlock == nil) @@ -86,7 +86,7 @@ class AnimationCompletionDelegate: NSObject, CAAnimationDelegate { var animationLayer: RootAnimationLayer? var animationKey: String? var ignoreDelegate = false - var animationState: AnimationContextState = .playing + var animationState = AnimationContextState.playing let completionBlock: LottieCompletionBlock? } diff --git a/Sources/Public/Animation/LottieAnimationLayer.swift b/Sources/Public/Animation/LottieAnimationLayer.swift index d9f2f7be41..76dc64a7d8 100644 --- a/Sources/Public/Animation/LottieAnimationLayer.swift +++ b/Sources/Public/Animation/LottieAnimationLayer.swift @@ -638,7 +638,7 @@ public class LottieAnimationLayer: CALayer { } /// Sets the loop behavior for `play` calls. Defaults to `playOnce` - public var loopMode: LottieLoopMode = .playOnce { + public var loopMode = LottieLoopMode.playOnce { didSet { updateInFlightAnimation() } @@ -857,9 +857,9 @@ public class LottieAnimationLayer: CALayer { public func removeValueProvider(for keypath: AnimationKeypath) { guard let animationLayer = rootAnimationLayer else { return } - valueProviders.forEach { - guard $0.key.matches(keypath) else { return } - valueProviders[$0.key] = nil + for valueProvider in valueProviders { + guard valueProvider.key.matches(keypath) else { continue } + valueProviders[valueProvider.key] = nil } animationLayer.removeValueProvider(for: keypath) } diff --git a/Sources/Public/Animation/LottieAnimationView.swift b/Sources/Public/Animation/LottieAnimationView.swift index 0c0676acb3..3c7473fb75 100644 --- a/Sources/Public/Animation/LottieAnimationView.swift +++ b/Sources/Public/Animation/LottieAnimationView.swift @@ -69,7 +69,7 @@ public enum LottieLoopMode: Hashable { // MARK: Equatable extension LottieLoopMode: Equatable { - public static func == (lhs: LottieLoopMode, rhs: LottieLoopMode) -> Bool { + public static func ==(lhs: LottieLoopMode, rhs: LottieLoopMode) -> Bool { switch (lhs, rhs) { case (.repeat(let lhsAmount), .repeat(let rhsAmount)), (.repeatBackwards(let lhsAmount), .repeatBackwards(let rhsAmount)): diff --git a/Sources/Public/Animation/LottieView.swift b/Sources/Public/Animation/LottieView.swift index aae74dfd46..f823d59808 100644 --- a/Sources/Public/Animation/LottieView.swift +++ b/Sources/Public/Animation/LottieView.swift @@ -494,8 +494,9 @@ public struct LottieView: UIViewConfiguringSwiftUIView { // MARK: Private - private let localAnimation: LottieAnimationSource? @State private var remoteAnimation: LottieAnimationSource? + + private let localAnimation: LottieAnimationSource? private var playbackMode: LottiePlaybackMode? private var animationSpeed: Double? private var reloadAnimationTrigger: AnyEquatable? @@ -505,9 +506,9 @@ public struct LottieView: UIViewConfiguringSwiftUIView { private var showPlaceholderWhileReloading = false private var textProvider: AnimationKeypathTextProvider = DefaultTextProvider() private var fontProvider: AnimationFontProvider = DefaultFontProvider() - private var configuration: LottieConfiguration = .shared - private var dotLottieConfigurationComponents: DotLottieConfigurationComponents = .imageProvider - private var logger: LottieLogger = .shared + private var configuration = LottieConfiguration.shared + private var dotLottieConfigurationComponents = DotLottieConfigurationComponents.imageProvider + private var logger = LottieLogger.shared private var sizing = SwiftUIMeasurementContainerStrategy.automatic private let placeholder: (() -> Placeholder)? @@ -593,7 +594,7 @@ public struct LottieView: UIViewConfiguringSwiftUIView { container.invalidateIntrinsicContentSize() } - if + if let playbackMode, playbackMode != view.currentPlaybackMode { diff --git a/Sources/Public/AnimationCache/DefaultAnimationCache.swift b/Sources/Public/AnimationCache/DefaultAnimationCache.swift index 57f2a9b4c8..204f30116a 100644 --- a/Sources/Public/AnimationCache/DefaultAnimationCache.swift +++ b/Sources/Public/AnimationCache/DefaultAnimationCache.swift @@ -58,7 +58,7 @@ public class DefaultAnimationCache: AnimationCacheProvider { private let cache = LRUCache() } -// MARK: Sendable +// MARK: @unchecked Sendable // LottieAnimationCache has a Sendable requirement, but we can't // redesign DefaultAnimationCache to be properly Sendable without diff --git a/Sources/Public/Controls/AnimatedSwitch.swift b/Sources/Public/Controls/AnimatedSwitch.swift index e116e06e31..3fd23742fd 100644 --- a/Sources/Public/Controls/AnimatedSwitch.swift +++ b/Sources/Public/Controls/AnimatedSwitch.swift @@ -112,11 +112,14 @@ open class AnimatedSwitch: AnimatedControl { } /// The cancel behavior for the switch. See CancelBehavior for options - public var cancelBehavior: CancelBehavior = .reverse + public var cancelBehavior = CancelBehavior.reverse /// If `false` the switch will not play the animation when changing between animations. public var animateUpdateWhenChangingAnimation = true + /// A closure that is called when the `isOn` state is updated + public var stateUpdated: ((_ isOn: Bool) -> Void)? + #if canImport(UIKit) public override var accessibilityTraits: UIAccessibilityTraits { set { super.accessibilityTraits = newValue } @@ -124,9 +127,6 @@ open class AnimatedSwitch: AnimatedControl { } #endif - /// A closure that is called when the `isOn` state is updated - public var stateUpdated: ((_ isOn: Bool) -> Void)? - /// The current state of the switch. public var isOn: Bool { set { diff --git a/Sources/Public/Controls/LottieButton.swift b/Sources/Public/Controls/LottieButton.swift index 396a101275..b4a630b165 100644 --- a/Sources/Public/Controls/LottieButton.swift +++ b/Sources/Public/Controls/LottieButton.swift @@ -117,6 +117,6 @@ public struct LottieButton: UIViewConfiguringSwiftUIView { private let animation: LottieAnimation? private let action: () -> Void - private var configuration: LottieConfiguration = .shared + private var configuration = LottieConfiguration.shared } #endif diff --git a/Sources/Public/Controls/LottieSwitch.swift b/Sources/Public/Controls/LottieSwitch.swift index fb65783296..fa6c4cc61f 100644 --- a/Sources/Public/Controls/LottieSwitch.swift +++ b/Sources/Public/Controls/LottieSwitch.swift @@ -138,7 +138,7 @@ public struct LottieSwitch: UIViewConfiguringSwiftUIView { // MARK: Private private let animation: LottieAnimation? - private var configuration: LottieConfiguration = .shared + private var configuration = LottieConfiguration.shared private var isOn: Binding? } diff --git a/Sources/Public/DotLottie/Cache/DotLottieCache.swift b/Sources/Public/DotLottie/Cache/DotLottieCache.swift index 1e7d00b11b..651e99a550 100644 --- a/Sources/Public/DotLottie/Cache/DotLottieCache.swift +++ b/Sources/Public/DotLottie/Cache/DotLottieCache.swift @@ -58,7 +58,7 @@ public class DotLottieCache: DotLottieCacheProvider { } -// MARK: Sendable +// MARK: @unchecked Sendable // DotLottieCacheProvider has a Sendable requirement, but we can't // redesign DotLottieCache to be properly Sendable without making breaking changes. diff --git a/Sources/Public/Keyframes/Keyframe.swift b/Sources/Public/Keyframes/Keyframe.swift index 626260cd5d..dcc83ba1ed 100644 --- a/Sources/Public/Keyframes/Keyframe.swift +++ b/Sources/Public/Keyframes/Keyframe.swift @@ -68,7 +68,7 @@ public final class Keyframe { // MARK: Equatable extension Keyframe: Equatable where T: Equatable { - public static func == (lhs: Keyframe, rhs: Keyframe) -> Bool { + public static func ==(lhs: Keyframe, rhs: Keyframe) -> Bool { lhs.value == rhs.value && lhs.time == rhs.time && lhs.isHold == rhs.isHold diff --git a/Sources/Public/macOS/LottieAnimationViewBase.macOS.swift b/Sources/Public/macOS/LottieAnimationViewBase.macOS.swift index d51e5c67f5..26959b44e4 100644 --- a/Sources/Public/macOS/LottieAnimationViewBase.macOS.swift +++ b/Sources/Public/macOS/LottieAnimationViewBase.macOS.swift @@ -39,7 +39,7 @@ open class LottieAnimationViewBase: NSView { true } - public var contentMode: LottieContentMode = .scaleAspectFit { + public var contentMode = LottieContentMode.scaleAspectFit { didSet { setNeedsLayout() } diff --git a/Tests/Utils/Snapshotting+presentationLayer.swift b/Tests/Utils/Snapshotting+presentationLayer.swift index 3b33862d47..aac7ddf308 100644 --- a/Tests/Utils/Snapshotting+presentationLayer.swift +++ b/Tests/Utils/Snapshotting+presentationLayer.swift @@ -37,11 +37,9 @@ extension Snapshotting where Value == UIView, Format == UIImage { fatalError("Presentation layer does not exist and cannot be snapshot") } - let image = UIGraphicsImageRenderer(bounds: view.bounds).image { context in + return UIGraphicsImageRenderer(bounds: view.bounds).image { context in presentationLayer.render(in: context.cgContext) } - - return image } } }