Skip to content

Commit

Permalink
fix Swift 5.8 + ImageResource
Browse files Browse the repository at this point in the history
  • Loading branch information
NikSativa committed Sep 30, 2024
1 parent f2c37f4 commit 7aacf80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions Source/CrossPlatform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,44 +40,44 @@ public protocol ImageView: AnyObject {

#if os(iOS) || os(tvOS)
private enum Screen {
#if swift(>=6.0)
#if swift(>=6.0)
@MainActor
static var scale: CGFloat {
return UIScreen.main.scale
}
#else
#else
static var scale: CGFloat {
return UIScreen.main.scale
}
#endif
#endif
}

#elseif os(watchOS)
import WatchKit

private enum Screen {
#if swift(>=6.0)
#if swift(>=6.0)
@MainActor
static var scale: CGFloat {
return WKInterfaceDevice.current().screenScale
}
#else
#else
static var scale: CGFloat {
return WKInterfaceDevice.current().screenScale
}
#endif
#endif
}

#elseif supportsVisionOS
public enum Screen {
// visionOS doesn't have a screen scale, so we'll just use 2x for Tests.
// override it on your own risk.
#if swift(>=6.0)
#if swift(>=6.0)
@MainActor
public static var scale: CGFloat?
#else
#else
public static var scale: CGFloat?
#endif
#endif
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Source/ImagePlaceholder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public enum ImagePlaceholder {
case imageNamed(String)
#endif

#if os(iOS) || os(tvOS) || supportsVisionOS
#if swift(>=5.9) && (os(iOS) || os(tvOS) || supportsVisionOS)
@available(iOS 17.0, macOS 14.0, tvOS 17.0, *)
func resource(_ res: ImageResource) -> Self {
return .init(resource: res)
Expand Down

0 comments on commit 7aacf80

Please sign in to comment.