over 8 years ago
Apple provides the UIPasteboard class which enables the data to be shared within the app and with another app. To share data we can use pasteboards.
Here is the code snippet depicting how copy and Paste functionality can be achieved in Swift using UIPasteBoards.
To copy the text using pasteboard:
1- Create the pasteboard object using general or shared system pasteboard
2- Use property ‘string’ to set the text to be copied.
To Print or fetch the text which was copied earlier :
1- Create the pasteboard object using shared system.
2- use extension property ‘string’ of pasteboard to get the copied string.
Thanks for reading
0 Comment(s)