Last active
January 9, 2016 22:43
-
-
Save ericdke/c77139301b77bbf6b4a7 to your computer and use it in GitHub Desktop.
Swift OS X: set text to PasteBoard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Cocoa | |
| func setTextToPasteBoard(text: String) -> Bool { | |
| let pasteBoard = NSPasteboard.generalPasteboard() | |
| pasteBoard.declareTypes([NSStringPboardType], owner: nil) | |
| return pasteBoard.writeObjects([text]) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment