I am trying to allow my users to make something like a collage in my app by pasting images into the canvasView, but I can't find any documentation on how to use the paste function for canvasView. I have tried the code below to paste from the UIPasteboard.general into the canvasView, and the system tells me the paste was successful but I don't see anything in the canvasView. Here is my function, called when the user taps the "paste" button in my UI:
Also note, I am using SwiftUI, but this doesn't seem to work in regular swift either.
Any thoughts?
Code Block private func pasteContent() { let pasteBoard = UIPasteboard.general if paste { if pasteBoard.hasImages { canvasView.paste(pasteBoard.image) paste.toggle() } else if pasteBoard.hasStrings { canvasView.paste(pasteBoard.string) paste.toggle() } } }
Also note, I am using SwiftUI, but this doesn't seem to work in regular swift either.
Any thoughts?