mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-11-22 08:17:28 +00:00
feat: add NicknameClipboard helper for people-row copy
One pasteboard write path for iOS and macOS so mesh and geohash menus do not duplicate UIKit/AppKit branches.
This commit is contained in:
parent
5e9287fae1
commit
4a83845083
26
bitchat/Utils/NicknameClipboard.swift
Normal file
26
bitchat/Utils/NicknameClipboard.swift
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// NicknameClipboard.swift
|
||||
// bitchat
|
||||
//
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// For more information, see <https://unlicense.org>
|
||||
//
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user