Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Swift 5.9 compiler #2289

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
'watchOS Simulator,name=Apple Watch Series 9 (41mm)'
]
xcode: [
'15.2',
'15.3',
'15.4',
'16.0',
]
Expand Down
20 changes: 16 additions & 4 deletions Sources/Image/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@

#if os(macOS)
import AppKit
nonisolated(unsafe) private let imagesKey = malloc(1)!
nonisolated(unsafe) private let durationKey = malloc(1)!
#else
#else // os(macOS)
import UIKit
import MobileCoreServices
#endif
#endif // os(macOS)

#if !os(watchOS)
import CoreImage
Expand All @@ -45,9 +43,23 @@ import ImageIO
import UniformTypeIdentifiers
#endif

#if compiler(>=5.10)
nonisolated(unsafe) private let animatedImageDataKey = malloc(1)!
nonisolated(unsafe) private let imageFrameCountKey = malloc(1)!
nonisolated(unsafe) private let imageSourceKey = malloc(1)!
#if os(macOS)
nonisolated(unsafe) private let imagesKey = malloc(1)!
nonisolated(unsafe) private let durationKey = malloc(1)!
#endif // os(macOS)
#else // compiler(>=5.10)
private let animatedImageDataKey = malloc(1)!
private let imageFrameCountKey = malloc(1)!
private let imageSourceKey = malloc(1)!
#if os(macOS)
private let imagesKey = malloc(1)!
private let durationKey = malloc(1)!
#endif // os(macOS)
#endif // compiler(>=5.10)

// MARK: - Image Properties
extension KingfisherWrapper where Base: KFCrossPlatformImage {
Expand Down