mana-swift-ui/Sources/ManaComponentsUI/PlatformClipboard.swift
Till JS 5d30d5a840 feat(ManaComponentsUI): ManaEmptyStateView + PlatformClipboard
- ManaEmptyStateView: geteilter Empty-/Zustands-Render (Symbol mit
  Theme-Akzent-Glow, Titel/Text, optionaler CTA). Farben aus
  @Environment(\.manaTheme). Blaupause: memoros EmptyStateView.
- PlatformClipboard: plattformübergreifendes Kopieren (UIPasteboard/
  NSPasteboard). Liegt hier statt in ManaCore, weil ManaCore
  UI-Framework-frei bleiben soll (Invariante 2).

CHANGELOG-Eintrag bleibt vorerst aus diesem Commit (CHANGELOG.md im
Repo vermischt sich mit anderer uncommitteter Arbeit).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 13:33:39 +02:00

21 lines
768 B
Swift

#if canImport(UIKit)
import UIKit
#elseif canImport(AppKit)
import AppKit
#endif
/// Plattform-übergreifendes Kopieren in die Zwischenablage. iOS nutzt
/// `UIPasteboard`, macOS `NSPasteboard`. Geteilt von den nativen Apps
/// (Listen-Kontextmenüs „Link kopieren" / „Markierung kopieren" etc.) —
/// sonst läge dasselbe `#if`-Snippet in jeder App mehrfach.
public enum PlatformClipboard {
/// Legt `text` als reinen Text in die System-Zwischenablage.
public static func copy(_ text: String) {
#if canImport(UIKit)
UIPasteboard.general.string = text
#elseif canImport(AppKit)
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(text, forType: .string)
#endif
}
}