Skip to content

Commit

Permalink
Add 'nsuiImage' attribute to ImageRenderer (#3)
Browse files Browse the repository at this point in the history
* Add 'nsuiImage' attribute to ImageRenderer

* add availability flags for tvOS and watchOS
  • Loading branch information
kaii-zen authored Nov 20, 2023
1 parent 2d33f34 commit 5a75d44
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/NSUI/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ extension Image {
}
}

@available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *)
extension ImageRenderer {
@MainActor
public var nsuiImage: NSUIImage? {
#if canImport(AppKit)
return nsImage
#elseif canImport(UIKit)
return uiImage
#endif
}
}

#if canImport(AppKit)
extension NSImage {
public var cgImage: CGImage? {
Expand Down

0 comments on commit 5a75d44

Please sign in to comment.