Learn Courses My Dashboard

Does anybody know how to paste an image from clipboard to a textEditor or UITextView?

does anybody know how to paste an image from clipboard to a textEditor or UITextView?

I cannot find a way to do it in Swiftui.

goal: create a oneNote or notion app where you can have text and images in the same field

I don’t know if this is possible in SwiftUI, I would guess no

It looks like they may help get you started

let attachment = NSTextAttachment()
attachment.image = scaledImage
let imageString = NSAttributedString(attachment: attachment)
textView.textStorage.insert(imageString, at: indexWhereYouWantTheImage)

https://developer.apple.com/forums/thread/678394

1 Like