import Foundation
#if canImport(UIKit)
import UIKit
#endif

struct SendableValueBox<Value>: @unchecked Sendable {
    let value: Value
    init(_ value: Value) { self.value = value }
}

enum ClipboardSink {
    @MainActor
    static func set(_ text: String) {
        #if canImport(UIKit)
        UIPasteboard.general.string = text
        #endif
    }

    @MainActor
    static func read() -> String? {
        #if canImport(UIKit)
        guard UIPasteboard.general.hasStrings else { return nil }
        return UIPasteboard.general.string
        #else
        return nil
        #endif
    }
}
