You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR simplifies our image attachment code so that it always requires
`UTType` instead of providing implementations for older Apple platforms.
For more information about the `UTType` API, watch
[this](https://developer.apple.com/videos/play/tech-talks/10696/) video.
There is a kitty.
Image attachments depend on `CGImage` and are Apple-specific at this
time. Non-Apple image attachment support is a future direction.
> [!NOTE]
> Image attachments are an experimental feature.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
@@ -61,7 +62,7 @@ public struct _AttachableImageWrapper<Image>: Sendable where Image: AttachableAs
61
62
varencodingQuality:Float
62
63
63
64
/// Storage for ``contentType``.
64
-
privatevar_contentType:(anySendable)?
65
+
privatevar_contentType:UTType?
65
66
66
67
/// The content type to use when encoding the image.
67
68
///
@@ -70,14 +71,9 @@ public struct _AttachableImageWrapper<Image>: Sendable where Image: AttachableAs
70
71
///
71
72
/// If the value of this property does not conform to [`UTType.image`](https://developer.apple.com/documentation/uniformtypeidentifiers/uttype-swift.struct/image),
72
73
/// the result is undefined.
73
-
@available(_uttypesAPI,*)
74
74
varcontentType:UTType{
75
75
get{
76
-
iflet contentType = _contentType as?UTType{
77
-
return contentType
78
-
}else{
79
-
return encodingQuality <1.0?.jpeg :.png
80
-
}
76
+
_contentType ??.image
81
77
}
82
78
set{
83
79
precondition(
@@ -92,41 +88,25 @@ public struct _AttachableImageWrapper<Image>: Sendable where Image: AttachableAs
92
88
/// type for `UTType.image`.
93
89
///
94
90
/// This property is not part of the public interface of the testing library.
0 commit comments