Skip to content

1.0.0

Latest

Choose a tag to compare

@Sushant-Hande Sushant-Hande released this 07 Jun 14:50
· 8 commits to master since this release
b95c814

Description

Copy & Read Feature

The library leverages Jetpack/Compose Multiplatform's Clipboard interface to provide a unified API. The core flow is:

  1. Common API: KclipboardManager defines suspend fun copy(String) and suspend fun getCopiedText(): String?.

  2. Implementation: KclipboardManagerImpl captures the platform's Clipboard (provided via LocalClipboard) and delegates operations.

  3. Platform Interop (expect/actual):

  • Android:

    • Converts String to ClipEntry using ClipData.newPlainText(label, text).
    • Reading extracts the first item from ClipData.
  • iOS:

    • Uses Compose's ClipEntry.withPlainText(text) which internally interacts with UIPasteboard.
    • Reading uses hasPlainText() and getPlainText().
  1. Composition Safety: The rememberKclipboardManager() factory ensures the manager is scoped to the composition lifecycle and correctly captures the LocalClipboard instance.