Skip to content

agent-polyblank/CMPLaunches

Repository files navigation

Compose Multiplatform Launches

This project is a reimplementation of the Kotlin Multiplatform (KMP) tutorial 'Create a multiplatform app using Ktor and SQLDelight' using Jetpack Compose for Mobile Multiplatform. It demonstrates how to build a cross-platform application that runs on both Android and iOS using shared Kotlin code and Compose for UI.

Features

  • Kotlin Multiplatform: Shared business logic across Android and iOS.
  • Jetpack Compose: Modern UI toolkit for building native UIs.
  • Compose for Multiplatform: Compose UI components for both Android and iOS.
  • Dependency Injection: Using Koin for dependency management.
  • Networking: Using Ktor for making network requests.
  • Database: Using SQLDelight for local database management.
  • Pull to Refresh: Implemented using dev.materii.pullrefresh.

Project Structure

  • commonMain: Contains shared code for both Android and iOS.
  • androidMain: Contains Android-specific code.
  • iosMain: Contains iOS-specific code.

Dependencies

  • Compose: For building UI.
  • Koin: For dependency injection.
  • Ktor: For networking.
  • SQLDelight: For database management.
  • Coil: For image loading.

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/kmplaunches.git
    cd kmplaunches
  2. Open the project in Android Studio:

    • Use Android Studio Arctic Fox or later.
  3. Build the project:

    • Sync the project with Gradle files.
    • Build the project to download all dependencies.

Running the App

Before running!

  • check your system with KDoctor
  • install JDK 17 or higher on your machine
  • add local.properties file to the project root and set a path to Android SDK there

Android

To run the application on android device/emulator:

  • open project in Android Studio and run imported android run configuration

To build the application bundle:

  • run ./gradlew :composeApp:assembleDebug
  • find .apk file in composeApp/build/outputs/apk/debug/composeApp-debug.apk Run android simulator UI tests: ./gradlew :composeApp:pixel5Check

iOS

To run the application on iPhone device/simulator:

  • Open iosApp/iosApp.xcproject in Xcode and run standard configuration
  • Or use Kotlin Multiplatform Mobile plugin for Android Studio Run iOS simulator UI tests: ./gradlew :composeApp:iosSimulatorArm64Test

Desktop

Run the desktop application: ./gradlew :composeApp:run Run desktop UI tests: ./gradlew :composeApp:jvmTest

This project is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgements

Special thanks to:

What's Next?

  • Add Network Status Detection
  • Add Routes and Navigation with Voyager
  • Add Unit Tests (lol)
  • Add Flow testing with Turbine.
  • Add UI Tests with Jetpack Compose Testing
  • CI/CD with GitHub Actions
  • Pre-commit hooks with Ktlint or Detekt
  • Rename the app to CMPLaunches
  • A decent looking error screen (that captures a few different http errors into a few easily readable messages)
  • Searching, Sorting and Filtering
  • Responsive UI layout for tablets and desktop
  • Preview for Jetpack Compose using the workaround for lack of multiplatform preview support shown here.
  • Desktop support (Might as well!)

About

A reimplementation of the KMP SpaceX Launches Tutorial in CMP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published