ImagePickerKMP 1.0.23: Controling Camera Launch on iOS with directCameraLaunch

Backer posted 1 min read

ImagePickerKMP 1.0.23: Controling Camera Launch on iOS with directCameraLaunch

The latest release of ImagePickerKMP (v1.0.23) brings a small but
powerful addition for iOS developers: a new flag called
directCameraLaunch.

This feature gives you control over whether the image picker should
open directly into the camera or show the source selection
dialog
first.

The New Flag: directCameraLaunch

By default, the picker shows a dialog on iOS asking the user to choose
between camera and gallery.\
With directCameraLaunch, you can now change that behavior:

  • directCameraLaunch = true → Skips the dialog and opens the
    camera immediately.\
  • directCameraLaunch = false → Keeps the dialog so the user can
    choose.

Usage Example

Here's how you can use it with ImagePickerLauncher in your Compose
Multiplatform project:

    ImagePickerLauncher(
        config = ImagePickerConfig(
            onPhotoCaptured = { result ->
                capturedPhoto = result
                showCamera = false
            },
            onError = {
                showCamera = false
            },
            onDismiss = {
                showImagePicker = false // Reset state when user doesn't select anything
            },
            directCameraLaunch = false // Set to true if you want to launch the camera directly Only IOS
        )
    )

Why This Matters

This new option provides better UX flexibility:

  • Apps that want a streamlined flow (e.g., scanning receipts, IDs, QR
    codes) can go straight to the camera.\
  • Apps that want to offer both gallery and camera selection can keep
    the dialog.

In short: you now have the best of both worlds, controlled with a simple
flag.

Dependency

To try it out, update your Gradle dependency to the latest version:

dependencies {
    implementation("io.github.ismoy:imagepickerkmp:1.0.23")
}

Final Thoughts

The directCameraLaunch flag makes ImagePickerKMP even more versatile
for real-world use cases. Whether your app prioritizes fast camera
access or user choice, you can now support both seamlessly with version
1.0.23.


Are you planning to use directCameraLaunch in your project? Would you
prefer the dialog or direct camera launch by default?

Github: https://github.com/ismoy/ImagePickerKMP

If you read this far, tweet to the author to show them you care. Tweet a Thanks
0 votes
0 votes

More Posts

Kotlin Multiplatform + Compose: Unified Camera & Gallery Picker with Expect/Actual

Ismoy - Aug 20

BelZSpeedScan: A Kotlin Multiplatform Library for Fast Document Scanning

Ismoy - Aug 21

Type-safe Kotlin Multiplatform i18n: auto-convert Android strings to cross-platform translations.

Ismoy - Oct 14

Simplifying Kotlin Multiplatform Setup with the New Android-KMP Plugin

Ismoy - Sep 3

Pattern-matching across different languages

Nicolas Fränkel - Jul 24
chevron_left