From c3d493b1fbe1368998ffb21110f0908078e108f3 Mon Sep 17 00:00:00 2001 From: Cal Stephens Date: Mon, 8 Jan 2024 10:07:06 -0800 Subject: [PATCH] Mark DotLottieCache as Sendable (#2245) --- .../xcshareddata/swiftpm/Package.resolved | 77 +++++++++---------- .../DotLottie/Cache/DotLottieCache.swift | 9 +++ .../Cache/DotLottieCacheProvider.swift | 2 +- 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved index 52b7a32f1c..b8f75ae465 100644 --- a/Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,43 +1,40 @@ { - "object": { - "pins": [ - { - "package": "Difference", - "repositoryURL": "https://github.com/krzysztofzablocki/Difference", - "state": { - "branch": null, - "revision": "02fe1111edc8318c4f8a0da96336fcbcc201f38b", - "version": "1.0.1" - } - }, - { - "package": "AirbnbSwift", - "repositoryURL": "https://github.com/airbnb/swift", - "state": { - "branch": null, - "revision": "6900f5ab7ab7394ac85eb9da52b2528ee329b206", - "version": "1.0.4" - } - }, - { - "package": "swift-argument-parser", - "repositoryURL": "https://github.com/apple/swift-argument-parser", - "state": { - "branch": null, - "revision": "fddd1c00396eed152c45a46bea9f47b98e59301d", - "version": "1.2.0" - } - }, - { - "package": "swift-snapshot-testing", - "repositoryURL": "https://github.com/pointfreeco/swift-snapshot-testing.git", - "state": { - "branch": null, - "revision": "0c2826f26d00ff5ddf2de92cb6b2139b0dd3d1ee", - "version": null - } + "pins" : [ + { + "identity" : "difference", + "kind" : "remoteSourceControl", + "location" : "https://github.com/krzysztofzablocki/Difference", + "state" : { + "revision" : "02fe1111edc8318c4f8a0da96336fcbcc201f38b", + "version" : "1.0.1" } - ] - }, - "version": 1 + }, + { + "identity" : "swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/airbnb/swift", + "state" : { + "revision" : "6900f5ab7ab7394ac85eb9da52b2528ee329b206", + "version" : "1.0.4" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser", + "state" : { + "revision" : "fddd1c00396eed152c45a46bea9f47b98e59301d", + "version" : "1.2.0" + } + }, + { + "identity" : "swift-snapshot-testing", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-snapshot-testing.git", + "state" : { + "revision" : "0c2826f26d00ff5ddf2de92cb6b2139b0dd3d1ee" + } + } + ], + "version" : 2 } diff --git a/Sources/Public/DotLottie/Cache/DotLottieCache.swift b/Sources/Public/DotLottie/Cache/DotLottieCache.swift index d2f2296489..1e7d00b11b 100644 --- a/Sources/Public/DotLottie/Cache/DotLottieCache.swift +++ b/Sources/Public/DotLottie/Cache/DotLottieCache.swift @@ -7,6 +7,8 @@ import Foundation +// MARK: - DotLottieCache + /// A DotLottie Cache that will store lottie files up to `cacheSize`. /// /// Once `cacheSize` is reached, the least recently used lottie will be ejected. @@ -55,3 +57,10 @@ public class DotLottieCache: DotLottieCacheProvider { private var cache = LRUCache() } + +// MARK: Sendable + +// DotLottieCacheProvider has a Sendable requirement, but we can't +// redesign DotLottieCache to be properly Sendable without making breaking changes. +// swiftlint:disable:next no_unchecked_sendable +extension DotLottieCache: @unchecked Sendable { } diff --git a/Sources/Public/DotLottie/Cache/DotLottieCacheProvider.swift b/Sources/Public/DotLottie/Cache/DotLottieCacheProvider.swift index 4b32c68295..6a59cba287 100644 --- a/Sources/Public/DotLottie/Cache/DotLottieCacheProvider.swift +++ b/Sources/Public/DotLottie/Cache/DotLottieCacheProvider.swift @@ -10,7 +10,7 @@ /// can increase performance when loading an animation multiple times. /// /// Lottie comes with a prebuilt LRU DotLottie Cache. -public protocol DotLottieCacheProvider { +public protocol DotLottieCacheProvider: Sendable { func file(forKey: String) -> DotLottieFile?