Apparently, you are not the only person who can try such a keyboard . If you look at the animated GIF on the site, the keyboard uses copy / paste to add the image to the messages.
The UIKeyInput Protocol , which is inherited by UITextDocumentProxy , has the following function:
func insertText(_ text: String)
They accept only String or NSString, as you already know. Since there are no other ways to insert content, we can assume that there is currently no other way.
Now I suggest you use a similar use. When a user clicks on an image, add it to UIPboardboard. Perhaps imagine a small banner on the keyboard that says “Now you can paste” or something like that, but it is up to you to decide.
erdekhayser
source share