Accessing native macOS API in Compose Multiplatform
summary
Shows how to get iCloud working from a Compose Multiplatform desktop app by compiling Kotlin/Native + JNI into a macOS dynamic library, exporting methods with CNAME, generating cinterop bindings, running the Gradle task linkReleaseShared and bundling/signing the lib into the app. Targets macOS ARM64 only, uploads a local database file to the app iCloud container, and works end-to-end but exposes real edge cases: container URL can be null (full account, disabled sync, offline), so error handling is required.
AI-written summary · about
chapters (12)
- 0:00Native macOS APIs in Compose
- 1:03Why access native APIs
- 3:55JNI limitations for native access
- 8:15Kotlin Native for macOS APIs
- 10:04Kotlin Native benefits
- 14:01Generating native library bindings
- 18:55iCloud upload in Kotlin
- 24:22Exporting Kotlin functions for JNI
- 26:27Compose Multiplatform to JNI
- 28:18Building native library
- 30:45Loading native library at runtime
- 32:51Summary
related talks
45mCompose Multiplatform on iOS
41mSharing and Separation — Design Guidelines for Compose Multiplatform Production Adoption
36mBest Practices for Developing Amazing Kotlin Multiplatform Apps
43mCompose Multiplatform for iOS: Ready for Production Use
39mKotlin and Compose Multiplatform patterns for iOS interop
18mKotlin native
45mThe Adventures of Kotlin And Compose Through the Multiplatform World
42mWhat’s New in Compose Multiplatform
