Skip to content

Commit

Permalink
Mark DotLottieCache as Sendable (#2245)
Browse files Browse the repository at this point in the history
  • Loading branch information
calda authored Jan 8, 2024
1 parent 3b80576 commit c3d493b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 41 deletions.
77 changes: 37 additions & 40 deletions Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -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
}
9 changes: 9 additions & 0 deletions Sources/Public/DotLottie/Cache/DotLottieCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -55,3 +57,10 @@ public class DotLottieCache: DotLottieCacheProvider {
private var cache = LRUCache<String, DotLottieFile>()

}

// 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 { }
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down

0 comments on commit c3d493b

Please sign in to comment.