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
Add a cross-import overlay with AppKit to allow attaching NSImages.
This PR adds on to the Core Graphics cross-import overlay added in #827 to allow attaching
instances of `NSImage` to a test.
`NSImage` is a more complicated animal because it is not `Sendable`, but we don't want to
make a (potentially very expensive) deep copy of its data until absolutely necessary. So
we check inside the image to see if its contained representations are known to be safely
copyable (i.e. copies made with `NSCopying` do not share any mutable state with their
originals.) If it looks safe to make a copy of the image by calling `copy()`, we do so;
otherwise, we try to make a deep copy of the image.
Due to how Swift implements polymorphism in protocol requirements, and because we don't
really know what they're doing, subclasses of `NSImage` just get a call to `copy()`
instead of deep introspection.
`UIImage` support will be implemented in a separate PR.
> [!NOTE]
> Attachments remain an experimental feature.
0 commit comments