
Library of common components for applications developed by Jéluchu focused on those with a Jetpack Compose core
JchuComponents is a collection of Kotlin Multiplatform utilities, Android Jetpack Compose components and native SwiftUI components for building Android and Apple applications with less repeated infrastructure.
JchuComponents 3 is under active development on the
v3branch. Pre-release versions follow3.0.0-alphaNN,3.0.0-betaNNand3.0.0-rcNNbefore the stable3.0.0release.
| Module | Android | iOS | macOS | Purpose |
|---|---|---|---|---|
jchucomponents-foundation |
✅ | ✅ | ✅ | Portable state, dates, text and utilities |
jchucomponents-network |
✅ | ✅ | ✅ | Ktor client configuration, resources and flow helpers |
jchucomponents-prefs |
✅ | ✅ | ✅ | Multiplatform DataStore preferences |
jchucomponents-pay |
✅ | ✅ | ✅ | Shared payment models and platform integrations |
jchucomponents-qr |
✅ | ✅ | ✅ | QR encoding and decoding utilities |
jchucomponents-core |
✅ | — | — | Android architecture and lifecycle utilities |
jchucomponents-ktx |
✅ | — | — | Android and Kotlin extensions |
jchucomponents-ui |
✅ | — | — | Jetpack Compose components |
jchucomponents-bom |
✅ | — | — | Aligned Android module versions |
The Swift package complements the shared Kotlin code with
JchuComponentsCore, JchuComponentsExtensions, JchuComponentsSwiftUI and
the optional native JchuComponentsPay product.
The examples below use 3.0.0-alpha07. Replace it with the
latest available release.
KMP artifacts are published to Maven Central. Add only the modules needed by your shared source set:
kotlin {
sourceSets {
commonMain.dependencies {
implementation(
"io.github.jeluchu:jchucomponents-foundation:3.0.0-alpha07"
)
implementation(
"io.github.jeluchu:jchucomponents-network:3.0.0-alpha07"
)
}
}
}The available Maven Central artifacts are:
io.github.jeluchu:jchucomponents-foundation
io.github.jeluchu:jchucomponents-network
io.github.jeluchu:jchucomponents-pay
io.github.jeluchu:jchucomponents-prefs
io.github.jeluchu:jchucomponents-qr
io.github.jeluchu:jchucomponents-bom
These artifacts contain Android, iOS and macOS variants. JitPack's Linux builds do not produce the Apple KLIB variants, so KMP applications targeting iOS or macOS should use Maven Central.
Add JitPack to settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}Use the BOM to keep Android modules on the same version:
dependencies {
implementation(
platform("io.github.jeluchu:jchucomponents-bom:3.0.0-alpha07")
)
implementation("com.github.jeluchu.jchucomponents:jchucomponents-ui")
implementation("com.github.jeluchu.jchucomponents:jchucomponents-ktx")
}Alternatively, specify each JitPack artifact version directly:
dependencies {
implementation(
"com.github.jeluchu.jchucomponents:jchucomponents-ui:3.0.0-alpha07"
)
}Add the following package URL in Xcode:
https://github.com/Jeluchu/jchucomponents-spm
Select the JchuComponents product and import the modules needed by the
application:
import JchuComponentsCore
import JchuComponentsExtensions
import JchuComponentsSwiftUIFor the native RevenueCat integration, also select and import the optional product:
import JchuComponentsPayThe Swift package currently requires iOS 26.0 or newer. Releases live in the
dedicated jchucomponents-spm repository so consumers do not clone the full
Kotlin and Android monorepo.
Create a platform-specific Ktor engine from shared Kotlin:
val client = createHttpClient(
HttpClientConfiguration(
baseUrl = "https://example.com/api/",
enableLogging = isDebug,
defaultHeaders = mapOf("X-Client" to "my-app"),
)
)createHttpClient uses Ktor's Android engine on Android and Darwin engine on
iOS and macOS. HttpClientConfiguration controls JSON, caching, timeouts,
response validation, logging and sensitive headers.
The v3 network result models and flow helpers belong to
jchucomponents-network:
import com.jeluchu.jchucomponents.network.extensions.flow.flowCollector
import com.jeluchu.jchucomponents.network.extensions.flow.flowResourceCollector
import com.jeluchu.jchucomponents.network.extensions.handleFailure
import com.jeluchu.jchucomponents.network.models.Failure
import com.jeluchu.jchucomponents.network.models.ResourceTheir previous jchucomponents-core packages were removed during the v3 alpha
cycle.
Experimental APIs should be explicitly marked with @RequiresOptIn. Once an
API becomes stable, incompatible changes require a deprecation cycle whenever
practical.
The repository includes an Android catalog in app and an iOS catalog in
samples/iosApp.
Run the repository-wide Android and Kotlin checks:
./gradlew ciCheckThis validates binary APIs, tests, debug and release assemblies, and all local Maven publications. See the consumer guide for focused setup and examples for every module.
Inspect Kotlin formatting without modifying source files:
./gradlew ktlintCheckHTML and plain-text reports are generated under each module's
build/reports/ktlint directory. The check is currently advisory and does not
fail CI. Apply safe automatic fixes to one module at a time:
./gradlew :jchucomponents-foundation:ktlintFormatReview the resulting diff before continuing with another module because some rules, such as file naming, require a manual decision.
Build the Android catalog:
./gradlew :app:assembleDebugVerify the artifacts as an external KMP consumer after publishing them locally:
./gradlew \
:jchucomponents-foundation:publishToMavenLocal \
:jchucomponents-network:publishToMavenLocal \
:jchucomponents-pay:publishToMavenLocal \
:jchucomponents-prefs:publishToMavenLocal \
:jchucomponents-qr:publishToMavenLocal
./gradlew \
-p smoke-tests/kmp-consumer \
compileAndroidMain \
compileKotlinIosSimulatorArm64 \
compileKotlinMacosArm64The smoke project reserves io.github.jeluchu for Maven Local, ensuring the
check cannot silently consume an already published release from Maven Central.
Build the Swift package after assembling the XCFramework:
./gradlew \
:jchucomponents-foundation:assembleJchuComponentsCoreReleaseXCFramework
xcodebuild \
-scheme JchuComponents-Package \
-destination 'generic/platform=iOS Simulator' \
buildFor contributions:
scripts/sync_strings.py synchronizes Android
strings.xml resources into an Apple Localizable.xcstrings catalog. It adds
new keys and locales, updates translations, converts placeholders such as
%1$s to %1$@ and ignores non-translatable strings.
Register it once as a Gradle task in the Android application module:
tasks.register<Exec>("syncIosStrings") {
group = "localization"
description = "Syncs Android strings into the iOS String Catalog"
commandLine(
"python3",
rootProject.file("scripts/sync_strings.py"),
"--xcstrings",
rootProject.file(
"iosApp/iosApp/resources/strings/Localizable.xcstrings"
),
"--android-res",
project.file("src/main/res"),
"--delete-missing",
)
}From then on, synchronization only requires running the Gradle task:
./gradlew :androidApp:syncIosStringsIt can also be saved as an Android Studio Gradle Run Configuration:
Sync localizables
:androidApp:syncIosStrings
This exposes synchronization as a one-click action from the IDE. Enable Store as project file if the run configuration should be shared with the rest of the team.
Remove --delete-missing when Apple-only keys must be preserved. Add
"--dry-run" to commandLine when the task should only preview changes.
Tagged 3.* versions trigger the release workflow. It validates the Gradle
version, API compatibility, tests, Android publications and the Swift package;
then it publishes the signed KMP variants and BOM to Maven Central and prepares
the dedicated SwiftPM repository.
Before tagging, update jchucomponents in gradle/libs.versions.toml and make
sure CI passes on v3:
git tag -a 3.0.0-alpha07 -m "3.0.0-alpha07"
git push origin v3
git push origin 3.0.0-alpha07SwiftPM publication additionally requires the repository variable
SPM_REPOSITORY_ENABLED=true and a SPM_REPOSITORY_TOKEN secret with write
access to Jeluchu/jchucomponents-spm.
JchuComponents is available under the Apache License 2.0.
JchuComponents is a collection of Kotlin Multiplatform utilities, Android Jetpack Compose components and native SwiftUI components for building Android and Apple applications with less repeated infrastructure.
JchuComponents 3 is under active development on the
v3branch. Pre-release versions follow3.0.0-alphaNN,3.0.0-betaNNand3.0.0-rcNNbefore the stable3.0.0release.
| Module | Android | iOS | macOS | Purpose |
|---|---|---|---|---|
jchucomponents-foundation |
✅ | ✅ | ✅ | Portable state, dates, text and utilities |
jchucomponents-network |
✅ | ✅ | ✅ | Ktor client configuration, resources and flow helpers |
jchucomponents-prefs |
✅ | ✅ | ✅ | Multiplatform DataStore preferences |
jchucomponents-pay |
✅ | ✅ | ✅ | Shared payment models and platform integrations |
jchucomponents-qr |
✅ | ✅ | ✅ | QR encoding and decoding utilities |
jchucomponents-core |
✅ | — | — | Android architecture and lifecycle utilities |
jchucomponents-ktx |
✅ | — | — | Android and Kotlin extensions |
jchucomponents-ui |
✅ | — | — | Jetpack Compose components |
jchucomponents-bom |
✅ | — | — | Aligned Android module versions |
The Swift package complements the shared Kotlin code with
JchuComponentsCore, JchuComponentsExtensions, JchuComponentsSwiftUI and
the optional native JchuComponentsPay product.
The examples below use 3.0.0-alpha07. Replace it with the
latest available release.
KMP artifacts are published to Maven Central. Add only the modules needed by your shared source set:
kotlin {
sourceSets {
commonMain.dependencies {
implementation(
"io.github.jeluchu:jchucomponents-foundation:3.0.0-alpha07"
)
implementation(
"io.github.jeluchu:jchucomponents-network:3.0.0-alpha07"
)
}
}
}The available Maven Central artifacts are:
io.github.jeluchu:jchucomponents-foundation
io.github.jeluchu:jchucomponents-network
io.github.jeluchu:jchucomponents-pay
io.github.jeluchu:jchucomponents-prefs
io.github.jeluchu:jchucomponents-qr
io.github.jeluchu:jchucomponents-bom
These artifacts contain Android, iOS and macOS variants. JitPack's Linux builds do not produce the Apple KLIB variants, so KMP applications targeting iOS or macOS should use Maven Central.
Add JitPack to settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}Use the BOM to keep Android modules on the same version:
dependencies {
implementation(
platform("io.github.jeluchu:jchucomponents-bom:3.0.0-alpha07")
)
implementation("com.github.jeluchu.jchucomponents:jchucomponents-ui")
implementation("com.github.jeluchu.jchucomponents:jchucomponents-ktx")
}Alternatively, specify each JitPack artifact version directly:
dependencies {
implementation(
"com.github.jeluchu.jchucomponents:jchucomponents-ui:3.0.0-alpha07"
)
}Add the following package URL in Xcode:
https://github.com/Jeluchu/jchucomponents-spm
Select the JchuComponents product and import the modules needed by the
application:
import JchuComponentsCore
import JchuComponentsExtensions
import JchuComponentsSwiftUIFor the native RevenueCat integration, also select and import the optional product:
import JchuComponentsPayThe Swift package currently requires iOS 26.0 or newer. Releases live in the
dedicated jchucomponents-spm repository so consumers do not clone the full
Kotlin and Android monorepo.
Create a platform-specific Ktor engine from shared Kotlin:
val client = createHttpClient(
HttpClientConfiguration(
baseUrl = "https://example.com/api/",
enableLogging = isDebug,
defaultHeaders = mapOf("X-Client" to "my-app"),
)
)createHttpClient uses Ktor's Android engine on Android and Darwin engine on
iOS and macOS. HttpClientConfiguration controls JSON, caching, timeouts,
response validation, logging and sensitive headers.
The v3 network result models and flow helpers belong to
jchucomponents-network:
import com.jeluchu.jchucomponents.network.extensions.flow.flowCollector
import com.jeluchu.jchucomponents.network.extensions.flow.flowResourceCollector
import com.jeluchu.jchucomponents.network.extensions.handleFailure
import com.jeluchu.jchucomponents.network.models.Failure
import com.jeluchu.jchucomponents.network.models.ResourceTheir previous jchucomponents-core packages were removed during the v3 alpha
cycle.
Experimental APIs should be explicitly marked with @RequiresOptIn. Once an
API becomes stable, incompatible changes require a deprecation cycle whenever
practical.
The repository includes an Android catalog in app and an iOS catalog in
samples/iosApp.
Run the repository-wide Android and Kotlin checks:
./gradlew ciCheckThis validates binary APIs, tests, debug and release assemblies, and all local Maven publications. See the consumer guide for focused setup and examples for every module.
Inspect Kotlin formatting without modifying source files:
./gradlew ktlintCheckHTML and plain-text reports are generated under each module's
build/reports/ktlint directory. The check is currently advisory and does not
fail CI. Apply safe automatic fixes to one module at a time:
./gradlew :jchucomponents-foundation:ktlintFormatReview the resulting diff before continuing with another module because some rules, such as file naming, require a manual decision.
Build the Android catalog:
./gradlew :app:assembleDebugVerify the artifacts as an external KMP consumer after publishing them locally:
./gradlew \
:jchucomponents-foundation:publishToMavenLocal \
:jchucomponents-network:publishToMavenLocal \
:jchucomponents-pay:publishToMavenLocal \
:jchucomponents-prefs:publishToMavenLocal \
:jchucomponents-qr:publishToMavenLocal
./gradlew \
-p smoke-tests/kmp-consumer \
compileAndroidMain \
compileKotlinIosSimulatorArm64 \
compileKotlinMacosArm64The smoke project reserves io.github.jeluchu for Maven Local, ensuring the
check cannot silently consume an already published release from Maven Central.
Build the Swift package after assembling the XCFramework:
./gradlew \
:jchucomponents-foundation:assembleJchuComponentsCoreReleaseXCFramework
xcodebuild \
-scheme JchuComponents-Package \
-destination 'generic/platform=iOS Simulator' \
buildFor contributions:
scripts/sync_strings.py synchronizes Android
strings.xml resources into an Apple Localizable.xcstrings catalog. It adds
new keys and locales, updates translations, converts placeholders such as
%1$s to %1$@ and ignores non-translatable strings.
Register it once as a Gradle task in the Android application module:
tasks.register<Exec>("syncIosStrings") {
group = "localization"
description = "Syncs Android strings into the iOS String Catalog"
commandLine(
"python3",
rootProject.file("scripts/sync_strings.py"),
"--xcstrings",
rootProject.file(
"iosApp/iosApp/resources/strings/Localizable.xcstrings"
),
"--android-res",
project.file("src/main/res"),
"--delete-missing",
)
}From then on, synchronization only requires running the Gradle task:
./gradlew :androidApp:syncIosStringsIt can also be saved as an Android Studio Gradle Run Configuration:
Sync localizables
:androidApp:syncIosStrings
This exposes synchronization as a one-click action from the IDE. Enable Store as project file if the run configuration should be shared with the rest of the team.
Remove --delete-missing when Apple-only keys must be preserved. Add
"--dry-run" to commandLine when the task should only preview changes.
Tagged 3.* versions trigger the release workflow. It validates the Gradle
version, API compatibility, tests, Android publications and the Swift package;
then it publishes the signed KMP variants and BOM to Maven Central and prepares
the dedicated SwiftPM repository.
Before tagging, update jchucomponents in gradle/libs.versions.toml and make
sure CI passes on v3:
git tag -a 3.0.0-alpha07 -m "3.0.0-alpha07"
git push origin v3
git push origin 3.0.0-alpha07SwiftPM publication additionally requires the repository variable
SPM_REPOSITORY_ENABLED=true and a SPM_REPOSITORY_TOKEN secret with write
access to Jeluchu/jchucomponents-spm.
JchuComponents is available under the Apache License 2.0.