Paste images in iPhone message boxes; let hands drive the simulator

This commit is contained in:
Ian Gulliver
2026-10-23 06:50:55 -07:00
parent de9a830cc6
commit c6da60f728
5 changed files with 33 additions and 7 deletions
+16
View File
@@ -183,6 +183,16 @@ final class ImageDrafts {
}
}
#if os(iOS)
private struct PastedImage: Transferable {
let data: Data
static var transferRepresentation: some TransferRepresentation {
DataRepresentation(importedContentType: .image) { PastedImage(data: $0) }
}
}
#endif
#if os(macOS)
struct ComposerTarget {
let paste: @MainActor (NSPasteboard) -> Bool
@@ -242,6 +252,12 @@ private struct ImageInput: ViewModifier {
content
#if os(macOS)
.focusedValue(\.composer, ComposerTarget(paste: { pb in store.images.add(key, pasteboard: pb, overlays) }))
#else
.pasteDestination(for: PastedImage.self) { pasted in
for p in pasted {
store.images.add(key, p.data, name: nil, overlays)
}
}
#endif
.overlay {
if targeted {