mirror of
https://github.com/otaviocc/Triton.git
synced 2026-01-30 04:04:27 +00:00
34 lines
729 B
Swift
34 lines
729 B
Swift
#if os(macOS)
|
|
|
|
import AppKit
|
|
|
|
struct MacOSClipboardService: ClipboardServiceProtocol {
|
|
|
|
func copy(_ string: String) {
|
|
NSPasteboard
|
|
.general
|
|
.clearContents()
|
|
|
|
NSPasteboard
|
|
.general
|
|
.setString(
|
|
string,
|
|
forType: .string
|
|
)
|
|
}
|
|
|
|
func copy(_ data: Data, type: String) {
|
|
NSPasteboard
|
|
.general
|
|
.clearContents()
|
|
|
|
NSPasteboard
|
|
.general
|
|
.setData(
|
|
data,
|
|
forType: NSPasteboard.PasteboardType(type)
|
|
)
|
|
}
|
|
}
|
|
|
|
#endif
|