Setting this property replaces all current items in the pasteboard with the new item. If the first item has no value of the indicated type, nil is returned.
let pasteboard = UIPasteboard.general
pasteboard.string = "hello world"
Sets the given string as the representation for the specified type for the first item on the receiver.
This method invokes setData(_:forType:) to perform the write.
let pasteboard = NSPasteboard.general
pasteboard.clearContents()
pasteboard.setString(text, forType: .string)
For iOS, use string
For Mac, use clearContents first
then setString