Skip to content

Commit a9953d8

Browse files
authored
Merge pull request #2400 from onevcat/fix/xcode-26
Fix Sendable warnings in Xcode 26
2 parents eb175c4 + 4a99f56 commit a9953d8

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

Sources/Cache/DiskStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public enum DiskStorage {
4343
/// ``DiskStorage/Config`` value or by modifying the ``DiskStorage/Backend/config`` property after it has been
4444
/// created. The ``DiskStorage/Backend`` will use the file's attributes to keep track of a file for its expiration
4545
/// or size limitation.
46-
public class Backend<T: DataTransformable>: @unchecked Sendable {
46+
public final class Backend<T: DataTransformable>: @unchecked Sendable where T: Sendable {
4747

4848
private let propertyQueue = DispatchQueue(label: "com.onevcat.kingfisher.DiskStorage.Backend.propertyQueue")
4949

Sources/Cache/MemoryStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public enum MemoryStorage {
5151
/// The `MemoryStorage` also includes a scheduled self-cleaning task to evict expired items from memory.
5252
///
5353
/// > This class is thready safe.
54-
public class Backend<T: CacheCostCalculable>: @unchecked Sendable {
54+
public final class Backend<T: CacheCostCalculable>: @unchecked Sendable where T: Sendable {
5555

5656
let storage = NSCache<NSString, StorageObject<T>>()
5757

Sources/SwiftUI/ImageBinder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extension KFImage {
6565
}
6666
}
6767

68-
func start<HoldingView: KFImageHoldingView>(context: Context<HoldingView>) {
68+
func start<HoldingView: KFImageHoldingView>(context: Context<HoldingView>) where HoldingView: Sendable {
6969
guard let source = context.source else {
7070
CallbackQueueMain.currentOrAsync {
7171
context.onFailureDelegate.call(KingfisherError.imageSettingError(reason: .emptySource))

Sources/SwiftUI/ImageContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import Combine
3030

3131
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
3232
extension KFImage {
33-
public class Context<HoldingView: KFImageHoldingView>: @unchecked Sendable {
33+
public class Context<HoldingView: KFImageHoldingView>: @unchecked Sendable where HoldingView: Sendable {
3434

3535
private let propertyQueue = DispatchQueue(label: "com.onevcat.Kingfisher.KFImageContextPropertyQueue")
3636

Sources/SwiftUI/KFAnimatedImage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ typealias KFCrossPlatformViewRepresentable = UIViewRepresentable
5757

5858
/// A wrapped `UIViewRepresentable` of `AnimatedImageView`
5959
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
60-
public struct KFAnimatedImageViewRepresenter: KFCrossPlatformViewRepresentable, KFImageHoldingView {
60+
public struct KFAnimatedImageViewRepresenter: KFCrossPlatformViewRepresentable, KFImageHoldingView, Sendable {
6161
public typealias RenderingView = AnimatedImageView
6262
public static func created(from image: KFCrossPlatformImage?, context: KFImage.Context<Self>) -> KFAnimatedImageViewRepresenter {
6363
KFAnimatedImageViewRepresenter(image: image, context: context)

Sources/SwiftUI/KFImageProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import Combine
3737
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
3838
@MainActor
3939
public protocol KFImageProtocol: View, KFOptionSetter {
40-
associatedtype HoldingView: KFImageHoldingView
40+
associatedtype HoldingView: KFImageHoldingView & Sendable
4141
var context: KFImage.Context<HoldingView> { get set }
4242
init(context: KFImage.Context<HoldingView>)
4343
}

Sources/SwiftUI/KFImageRenderer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import Combine
3131
/// A Kingfisher compatible SwiftUI `View` to load an image from a `Source`.
3232
/// Declaring a `KFImage` in a `View`'s body to trigger loading from the given `Source`.
3333
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
34-
struct KFImageRenderer<HoldingView> : View where HoldingView: KFImageHoldingView {
34+
struct KFImageRenderer<HoldingView> : View where HoldingView: KFImageHoldingView & Sendable {
3535

3636
@StateObject var binder: KFImage.ImageBinder = .init()
3737
let context: KFImage.Context<HoldingView>

0 commit comments

Comments
 (0)