summaryrefslogtreecommitdiff
path: root/Sora/Views/Post/Details/PostDetailsImageView.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-06-25 06:53:00 -0700
committerFuwn <[email protected]>2025-06-25 06:53:00 -0700
commit78056fc1fff43b45b1863c7338afd6b1c45486be (patch)
tree80d7e50160daf667f0eb3a05381cce05d0d33a52 /Sora/Views/Post/Details/PostDetailsImageView.swift
parentfeat: Development commit (diff)
downloadsora-testing-78056fc1fff43b45b1863c7338afd6b1c45486be.tar.xz
sora-testing-78056fc1fff43b45b1863c7338afd6b1c45486be.zip
feat: Development commit
Diffstat (limited to 'Sora/Views/Post/Details/PostDetailsImageView.swift')
-rw-r--r--Sora/Views/Post/Details/PostDetailsImageView.swift20
1 files changed, 20 insertions, 0 deletions
diff --git a/Sora/Views/Post/Details/PostDetailsImageView.swift b/Sora/Views/Post/Details/PostDetailsImageView.swift
index 0ab28c4..7d52a51 100644
--- a/Sora/Views/Post/Details/PostDetailsImageView.swift
+++ b/Sora/Views/Post/Details/PostDetailsImageView.swift
@@ -50,6 +50,26 @@ struct PostDetailsImageView<Placeholder: View>: View {
}
#endif
+ Button {
+ #if os(iOS)
+ let url = url
+
+ Task(priority: .userInitiated) {
+ // swiftlint:disable:next legacy_objc_type
+ if let data = NSData(contentsOf: url ?? URL(string: "")!) {
+ UIPasteboard.general.image = UIImage(data: data as Data)
+ }
+ }
+ #else
+ if let url {
+ NSPasteboard.general.clearContents()
+ NSPasteboard.general.writeObjects([NSImage(byReferencing: url)])
+ }
+ #endif
+ } label: {
+ Label("Copy", systemImage: "doc.on.doc")
+ }
+
#if os(macOS)
Button {
saveImageToPicturesFolder()