A comprehensive Kotlin Multiplatform library for Android and iOS.
Kross is an "all-in-one" Kotlin Multiplatform library designed to simplify cross-platform development. It provides a suite of unified, type-safe APIs for common platform tasks, starting with robust clipboard management.
Add Maven Central to your repositories:
repositories {
mavenCentral()
}Access all Kross features (Clipboard, etc.) through a single dependency.
// In commonMain
implementation("io.github.amanbutnot:kross:<latest>")If you only need a specific feature, you can include individual modules.
// In commonMain
implementation("io.github.amanbutnot:kross-clipboard:<latest>")// In commonMain
implementation("io.github.amanbutnot:kross-intents:<latest>")Kross Clipboard provides a type-safe, unified API to interact with system clipboards. It abstracts away platform-specific implementations like ClipboardManager on Android and UIPasteboard on iOS.
- Unified Interface: Single API for copying and retrieving data.
- Content Types: Native support for Plain Text, HTML, and URLs.
- Type Safety: Leverages Kotlin sealed classes for robust data handling.
- Lightweight: Zero third-party dependencies.
Kross Intents allows you to easily trigger common system actions like opening emails, maps, or settings.
- Email, Phone, SMS: Quick access to communication apps.
- Maps: Open locations with coordinates.
- System Settings: Navigate directly to General settings.
Klipboard is initialized without arguments on all platforms.
val klipboard = Klipboard()Use saveData with a specific KlipData type.
klipboard.saveData(KlipData.TEXT("Hello Kross"))
klipboard.saveData(KlipData.HTML("<b>Rich Text</b>"))
klipboard.saveData(KlipData.URL("https://github.com/amanbutnot/kross"))Query the clipboard by passing the desired KlipType.
val text = klipboard.getData(KlipType.TEXT) as? KlipData.TEXT
val html = klipboard.getData(KlipType.HTML) as? KlipData.HTMLTrigger common system actions using the KrossIntents singleton.
// Open Email
KrossIntents.openEmail(recipient = "test@example.com", subject = "Hi", text = "Hello from Kross!")
// Open Maps
KrossIntents.openMaps(latitude = 37.7749, longitude = -122.4194)
// Open Settings
KrossIntents.openSettings()Kross is available under the Apache License 2.0. See the LICENSE file for more info.