'SwiftUI - How can I get stickers from keyboard to my app?

I am trying to get stickers from the keyboard and display it in my app. I've seen whatsapp has this feature but it's been a real headache trying to implement it.

enter image description here

I have the following but it just crashes when trying to set the memojuString as the pasted item. Any ideas?

@State private var memojiString: UIImage = UIImage()

Button {
memojiString = UIPasteboard.general.image!
} label: {
Text("Paste memoji")
}
                            
Image(uiImage: memojiString)

Full code here:

https://wtools.io/paste-code/b9CN



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source