@@ -19,6 +19,11 @@ import UniformTypeIdentifiers
19
19
import AppKit // For NSImage extensions.
20
20
#endif
21
21
22
+ #if os(watchOS)
23
+ import ImageIO
24
+ import CoreGraphics
25
+ #endif
26
+
22
27
private let imageCompressionQuality : CGFloat = 0.8
23
28
24
29
/// An enum describing failures that can occur when converting image types to model content data.
@@ -38,7 +43,7 @@ public enum ImageConversionError: Error {
38
43
39
44
#if canImport(UIKit)
40
45
/// Enables images to be representable as ``ThrowingPartsRepresentable``.
41
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , * )
46
+ @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , watchOS 8 . 0 , * )
42
47
extension UIImage : ThrowingPartsRepresentable {
43
48
public func tryPartsValue( ) throws -> [ ModelContent . Part ] {
44
49
guard let data = jpegData ( compressionQuality: imageCompressionQuality) else {
@@ -50,7 +55,7 @@ public enum ImageConversionError: Error {
50
55
51
56
#elseif canImport(AppKit)
52
57
/// Enables images to be representable as ``ThrowingPartsRepresentable``.
53
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , * )
58
+ @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , watchOS 8 . 0 , * )
54
59
extension NSImage : ThrowingPartsRepresentable {
55
60
public func tryPartsValue( ) throws -> [ ModelContent . Part ] {
56
61
guard let cgImage = cgImage ( forProposedRect: nil , context: nil , hints: nil ) else {
@@ -67,7 +72,7 @@ public enum ImageConversionError: Error {
67
72
#endif
68
73
69
74
/// Enables `CGImages` to be representable as model content.
70
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , * )
75
+ @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , watchOS 9 . 0 , * )
71
76
extension CGImage : ThrowingPartsRepresentable {
72
77
public func tryPartsValue( ) throws -> [ ModelContent . Part ] {
73
78
let output = NSMutableData ( )
0 commit comments