How can I read a string from the clipboard and write it on a button's title? I can copy a string to the clipboard with:
UIPasteboard.generalPasteboard().string = "Hello world"
But how do I read that string from the clipboard and assign it to a String?
Just read it back into a variable like this:
let pasteboardString: String? = UIPasteboard.general.string
if let theString = pasteboardString {
print("String is \(theString)")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With