Skip to content

feat: Migrate Compose library to Compose Multiplatform and add standalone CMP sample app - #108

Merged
jacob-derynk merged 17 commits into
masterfrom
feature/cmp-library-migrate-compose-to-cmp
Oct 1, 2025
Merged

jacob-derynk merged 17 commits into
masterfrom
feature/cmp-library-migrate-compose-to-cmp

Conversation

@jacob-derynk

Copy link
Copy Markdown
Contributor

🚀 Major Upgrade: Compose Multiplatform Migration

This PR represents a significant upgrade to modernize the Donut library by migrating from Android-only Compose to Compose Multiplatform (CMP), enabling cross-platform support for iOS and other platforms.

✨ Key Changes

Compose Multiplatform Migration

  • Upgraded library-compose module to use Compose Multiplatform instead of Android-only Compose
  • Added iOS support with proper framework configuration for iOS targets (iosX64, iosArm64, iosSimulatorArm64)
  • Updated build configuration to use CMP plugins and dependencies

New Standalone CMP Sample App

  • Created sample-cmp module - a dedicated Compose Multiplatform sample application
  • Added iOS app integration
  • Implemented shared UI components:
    • RadioButtonGroup - reusable radio button component
    • SliderControl - cross-platform slider implementation
    • DecimalFormatter - utility for number formatting
    • Circle - common circle drawing component

Sample App Simplification

  • Removed Compose example from the main Android sample app
  • Made View-based example the default for the sample module

Documentation Updates

  • Updated README to feature Compose Multiplatform prominently
  • Added CMP installation instructions for Kotlin Multiplatform projects

Breaking Changes: None - this is a backward-compatible upgrade that adds new functionality while preserving existing APIs.

This commit introduces a new `library-compose-multiplatform` module to the project

Key changes include:

- **New Module:** Added `library-compose-multiplatform` with necessary Gradle configuration for Kotlin Multiplatform and Compose Multiplatform.
- **Dependencies:** Included Compose Multiplatform libraries (runtime, ui, foundation, animation, material3) in `libs.versions.toml`.
- **Sample Integration:**
    - Added a "Hello World" Composable (`HelloWorld.kt`) in the new module.
    - Created a new `HelloWorldActivity` in the sample app to display this Composable.
    - Added a button in `MainActivity` to navigate to the `HelloWorldActivity`.
- **Build Configuration:**
    - Updated `settings.gradle.kts` to include the new module and Compose Multiplatform repositories.
    - Updated root `build.gradle.kts` to include Kotlin Multiplatform and Compose Multiplatform plugins.
    - Added `.kotlin/` to `.gitignore`.
- **Sample UI Update:** Modified `activity_main.xml` and `strings.xml` in the sample app to accommodate the new "Hello World CMP" button.
This commit introduces a new `sample-cmp` module which will contain a Compose Multiplatform sample application for Android and iOS.

The following changes were made:
- Created the `sample-cmp` module with initial Android and iOS setup.
- Added basic "Hello iOS & Android from CMP" screen in common code.
- Configured Gradle for the new module, including dependencies for Compose Multiplatform.
- Set up the Android part of the sample with an `MainActivity` and resources.
- Set up the iOS part of the sample with an Xcode project, Swift entry point, and assets.
- Removed the old `HelloWorld` composable and its associated activity from the `library-compose-multiplatform` and `sample` modules respectively, as its functionality is now covered by the new `sample-cmp` module.
- Updated the main sample app to remove the button linking to the deleted `HelloWorldActivity`.
- Added `iosApp/DonutSampleIOS/Config/Signing.local.xcconfig` to `.gitignore`.
Renames `Signing.local.xcconfig` to `Signing.local.xcconfig.example` and adds it to `.gitignore` to prevent committing local signing configurations.
Also adds `xcuserdata` and `*.xcuserstate` to `.gitignore` to avoid committing user-specific Xcode project settings.
@jacob-derynk jacob-derynk self-assigned this Aug 28, 2025
Comment thread gradle/libs.versions.toml Outdated
Comment thread library-compose/build.gradle.kts Outdated
This commit removes the iOS-specific targets (iosX64, iosArm64, iosSimulatorArm64) and their associated framework configurations from the `library-compose/build.gradle.kts` file. Additionally, the `commonTest` source set and its dependency on `kotlin("test")` have been removed.
This commit updates the Compose Multiplatform dependencies to use the new `compose` object for easier access and removes the no longer needed `compose-mpp` bundle from the version catalog.
@jacob-derynk

Copy link
Copy Markdown
Contributor Author

I also plan to create a follow-up PR to move the legacy Android-only sample project into sample-cmp's androidMain source set to better organize the project.

This commit removes the legacy Android-only `sample` module and integrates its functionality into the `sample-cmp` (Compose Multiplatform) module.

The `sample-cmp` module now offers a chooser screen to navigate between the Compose Multiplatform and the legacy Android Views implementations of the Donut component.

Key changes:
- Deleted the `sample` module and all its contents.
- Moved relevant resources (layouts, drawables, strings, colors, styles) and Kotlin utility files from `sample` to `sample-cmp/src/androidMain`.
- Created `ViewsSampleActivity.kt` in `sample-cmp` to host the legacy Views sample.
- Created `CmpSampleActivity.kt` in `sample-cmp` to host the Compose Multiplatform sample.
- Updated `MainActivity.kt` in `sample-cmp` to display a chooser screen for selecting between the CMP and Views samples.
- Updated `AndroidManifest.xml` in `sample-cmp` to declare the new activities and set `MainActivity` as the launcher.
- Updated `sample-cmp/build.gradle.kts` to include dependencies for the legacy Views implementation (appcompat, constraintlayout, material) and the main library.
- Updated `settings.gradle.kts` to remove the `sample` module.
- Updated `README.md` to reflect the consolidated sample app structure.
- Updated `Dangerfile` to point to the new location of ktlint reports for the sample app.
- Updated Android Gradle Plugin version in `gradle/libs.versions.toml`.
…o-one-module

Feat: Merge sample apps and update dependencies
@jacob-derynk
jacob-derynk enabled auto-merge October 1, 2025 12:27
@jacob-derynk
jacob-derynk merged commit acc111c into master Oct 1, 2025
1 check passed
@jacob-derynk
jacob-derynk deleted the feature/cmp-library-migrate-compose-to-cmp branch October 1, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants