Skip to content

Commit

Permalink
Add visionOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Aug 11, 2023
1 parent 29d3a7e commit f8e1035
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 9 deletions.
18 changes: 18 additions & 0 deletions Nuke.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,9 @@
OTHER_SWIFT_FLAGS = "-D DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = com.github.kean.nukeui;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator driverkit iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = 7;
};
name = Debug;
};
Expand All @@ -1867,6 +1870,9 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.github.kean.nukeui;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator driverkit iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = 7;
};
name = Release;
};
Expand Down Expand Up @@ -1950,7 +1956,10 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "com.github.kean.nuke-extensions";
PRODUCT_NAME = NukeExtensions;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator driverkit iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
TARGETED_DEVICE_FAMILY = 7;
};
name = Debug;
};
Expand All @@ -1970,6 +1979,9 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "com.github.kean.nuke-extensions";
PRODUCT_NAME = NukeExtensions;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator driverkit iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = 7;
};
name = Release;
};
Expand Down Expand Up @@ -2312,6 +2324,9 @@
OTHER_SWIFT_FLAGS = "-D DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = com.github.kean.nuke;
PRODUCT_NAME = Nuke;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator driverkit iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = 7;
};
name = Debug;
};
Expand All @@ -2331,6 +2346,9 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.github.kean.nuke;
PRODUCT_NAME = Nuke;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator driverkit iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = 7;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.6
// swift-tools-version:5.8
import PackageDescription

let package = Package(
Expand Down
16 changes: 11 additions & 5 deletions Sources/Nuke/Internal/Graphics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

import Foundation

#if os(iOS) || os(tvOS) || os(watchOS)
import UIKit
#endif

#if os(watchOS)
import ImageIO
import CoreGraphics
Expand All @@ -18,6 +14,14 @@ import WatchKit.WKInterfaceDevice
import Cocoa
#endif

#if canImport(UIKit)
import UIKit
#endif

#if canImport(AppKit)
import AppKit
#endif

extension PlatformImage {
var processed: ImageProcessingExtensions {
ImageProcessingExtensions(image: self)
Expand Down Expand Up @@ -242,7 +246,7 @@ extension CGImagePropertyOrientation {
}
#endif

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
private extension CGSize {
func rotatedForOrientation(_ imageOrientation: CGImagePropertyOrientation) -> CGSize {
switch imageOrientation {
Expand Down Expand Up @@ -325,6 +329,8 @@ enum Screen {
#elseif os(macOS)
/// Always returns 1.
static let scale: CGFloat = 1
#else
static let scale: CGFloat = 1
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Nuke/Processing/ImageProcessingOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public enum ImageProcessingOptions: Sendable {
public struct Border: Hashable, CustomStringConvertible, @unchecked Sendable {
public let width: CGFloat

#if os(iOS) || os(tvOS) || os(watchOS)
#if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
public let color: UIColor

/// - parameters:
Expand Down
2 changes: 1 addition & 1 deletion Sources/NukeUI/LazyImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private struct LazyImageDemoView: View {
image.resizable().aspectRatio(contentMode: .fit)
}
}
#if !os(watchOS)
#if !os(watchOS) && !os(visionOS)
.processors(isBlured ? [ImageProcessors.GaussianBlur()] : [])
#endif
.id(imageViewId) // Example of how to implement retry
Expand Down
2 changes: 1 addition & 1 deletion Sources/NukeUI/LazyImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public final class LazyImageView: _PlatformBaseView {
}
}

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

private func runFadeInTransition(duration: TimeInterval) {
guard !imageView.isHidden else { return }
Expand Down

0 comments on commit f8e1035

Please sign in to comment.