Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compose Multiplatform Support #1208

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

Compose Multiplatform Support #1208

wants to merge 15 commits into from

Conversation

blakelee
Copy link
Collaborator

@blakelee blakelee commented Jun 28, 2024

Overview

This pull request add Kotlin Multiplatform (KMP) support for the workflow-ui:compose module. Some of the most notable changes are the build.gradle.kts configurations and changing/adding targets e.g. androidMain vs main

Note that this PR also uses a commit from @MilanJovic92 #1185. The bulk of this PR is simply copying that module over. The changes I made will cut the PR size in half.

All of the iOS target UI tests pass. Tests that contained Android code (View and Dialog) were removed for iOS but retained for Android.

The Compose samples have also been update to support iOS. Due to some limitations, the samples that use the Preview aren't shown as well any that used Android specific code. All of the Android code works the same as before.

While not tested, this should also work for Desktop and JS 🎉

Considerations

  • Compose Multiplatform release cycles are different than Jetpack Compose Android so we may just want to make a new package in :workflow-ui:compose-multiplatform

The gap between a Compose Multiplatform release and a Jetpack Compose release is usually 1–3 months.

From here

  • Support for multiplatform besides Android is probably going to have to be community maintained since it's not in use at Square
  • The minimal Kotlin version needed for this to work is 1.9.24 which is higher than what we had before. This is due to needing Jetbrains version of lifecycle which just recently released in May 2024.

EDIT: It looks like the above may not be true after getting this message from the KMP team here JetBrains/compose-multiplatform#5047 (comment)

Todo

  • There's not native back handling so it needs to be done manually. I have a sample implementation in the compose-samples for how to do this for multiplatform.
  • The iOS dialog equivalent is not supported, this is pure Kotlin Multiplatform code
  • The snapshot saving functions are only available in Android
  • There could be a lot more work on the gradle plugins which is why you see my apply stuff from the toml
  • The compose-ui-tooling package needs to be updated for KMP support but can be done pretty trivially
  • The publish plugins are commented out because I don't know how to do that and it made my syncs fail whenever I changed anything
  • I added https://github.com/autonomousapps/dependency-analysis-gradle-plugin for doing project health but this will be removed if this project ever goes anywhere.

Here is a demo of the compose-samples working

Simulator.Screen.Recording.-.iPhone.15.-.2024-06-28.at.13.47.18.mp4

Notes

Some UI tests are failing due to an issue with LeakCanary and Google. See here. The issue is fixed with Lifecycle 2.8.2 but Jetbrains hasn't updated their version of Lifecycle to match it.

@CLAassistant
Copy link

CLAassistant commented Jun 28, 2024

CLA assistant check
All committers have signed the CLA.

blakelee and others added 5 commits June 28, 2024 20:52
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

4 participants