diff --git a/bitchat/Utils/NicknameClipboard.swift b/bitchat/Utils/NicknameClipboard.swift new file mode 100644 index 00000000..88e94f48 --- /dev/null +++ b/bitchat/Utils/NicknameClipboard.swift @@ -0,0 +1,26 @@ +// +// NicknameClipboard.swift +// bitchat +// +// This is free and unencumbered software released into the public domain. +// For more information, see +// + +import Foundation +#if os(iOS) +import UIKit +#elseif os(macOS) +import AppKit +#endif + +/// Pasteboard writes for people-sheet nickname / display-name copy actions. +enum NicknameClipboard { + static func copy(_ string: String) { + #if os(iOS) + UIPasteboard.general.string = string + #elseif os(macOS) + NSPasteboard.general.clearContents() + NSPasteboard.general.setString(string, forType: .string) + #endif + } +}