How to copy text to clipboard/pasteboard with Swift

If all you want is plain text, you can just use the string property. It’s both readable and writable: // write to clipboard UIPasteboard.general.string = “Hello world” // read from clipboard let content = UIPasteboard.general.string (When reading from the clipboard, the UIPasteboard documentation also suggests you might want to first check hasStrings, “to avoid causing … Read more