Skip to content

Commit

Permalink
Merge pull request #2273 from NachoSoto/nacho/compiler
Browse files Browse the repository at this point in the history
Change `swift(>=6)` to use `compiler`
  • Loading branch information
onevcat authored Jul 14, 2024
2 parents 9fd9a60 + a4f5a41 commit e26db2a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Sources/Cache/ImageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ open class ImageCache: @unchecked Sendable {
cleanExpiredDiskCache {
Task {
guard let bgTask = await taskActor.value, bgTask != .invalid else { return }
#if swift(>=6)
#if compiler(>=6)
sharedApplication.endBackgroundTask(bgTask)
#else
await sharedApplication.endBackgroundTask(bgTask)
Expand Down
2 changes: 1 addition & 1 deletion Sources/General/ImageSource/AVAssetImageDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import MobileCoreServices
import CoreServices
#endif

#if swift(>=6)
#if compiler(>=6)
extension AVAssetImageGenerator: @unchecked @retroactive Sendable { }
#else
extension AVAssetImageGenerator: @unchecked Sendable { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Foundation

import PhotosUI

#if swift(>=6)
#if compiler(>=6)
@available(iOS 14.0, macOS 13.0, *)
extension PHPickerResult: @unchecked @retroactive Sendable { }
#else
Expand Down
4 changes: 2 additions & 2 deletions Sources/General/Kingfisher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public typealias KFCrossPlatformImageView = NSImageView
public typealias KFCrossPlatformButton = NSButton

// `NSImage` is not yet Sendable. We have to assume it sendable to resolve warnings in Kingfisher.
#if swift(>=6)
#if compiler(>=6)
extension KFCrossPlatformImage: @retroactive @unchecked Sendable { }
#else
extension KFCrossPlatformImage: @unchecked Sendable { }
#endif // swift(>=6)
#endif // compiler(>=6)
#else // os(macOS)
import UIKit
public typealias KFCrossPlatformImage = UIImage
Expand Down
8 changes: 4 additions & 4 deletions Sources/Utility/DisplayLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension UIView {
}
}

#if swift(>=6)
#if compiler(>=6)
extension CADisplayLink: DisplayLinkCompatible, @retroactive @unchecked Sendable {}
#else
extension CADisplayLink: DisplayLinkCompatible, @unchecked Sendable {}
Expand All @@ -78,13 +78,13 @@ extension NSView {
extension CADisplayLink: DisplayLinkCompatible {
var preferredFramesPerSecond: NSInteger { return 0 }
}
#if swift(>=6)
#if compiler(>=6)
@available(macOS 14.0, *)
extension CADisplayLink: @retroactive @unchecked Sendable { }
#else // swift(>=6)
#else // compiler(>=6)
@available(macOS 14.0, *)
extension CADisplayLink: @unchecked Sendable { }
#endif // swift(>=6)
#endif // compiler(>=6)
#endif // swift(>=5.9)

final class DisplayLink: DisplayLinkCompatible, @unchecked Sendable {
Expand Down
2 changes: 1 addition & 1 deletion Tests/KingfisherTests/DiskStorageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import XCTest
@testable import Kingfisher

#if swift(>=6)
#if compiler(>=6)
extension String: @retroactive DataTransformable { }
#else
extension String: DataTransformable { }
Expand Down
2 changes: 1 addition & 1 deletion Tests/KingfisherTests/ImageViewExtensionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ class ImageViewExtensionTests: XCTestCase {

}

#if swift(>=6)
#if compiler(>=6)
extension KFCrossPlatformView: @retroactive Placeholder {}
#else
extension KFCrossPlatformView: Placeholder {}
Expand Down
2 changes: 1 addition & 1 deletion Tests/KingfisherTests/MemoryStorageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension Int {
}
}

#if swift(>=6)
#if compiler(>=6)
extension Int: @retroactive CacheCostCalculable { }
#else
extension Int: CacheCostCalculable { }
Expand Down

0 comments on commit e26db2a

Please sign in to comment.