ComposeDebugDrawer icon indicating copy to clipboard operation
ComposeDebugDrawer copied to clipboard

Support Compose Multiplatform

Open dalewking opened this issue 1 year ago • 1 comments

Currently this is Android only. Now that Compose Multiplatform is a thing would be nice to support other platforms

dalewking avatar Sep 11 '24 15:09 dalewking

I currently just started converting my compose libraries to KMP... I'm currently converting my KotPreferences library and will step by step convert all my compose libraries afterwards...

I will only support android and jvm though - if a library is KMP only then it should work everywhere, if not, I can not provide an iOS implementation myself as I don't own a mac to make any tests nor do I have experience with native iOS coding yet...

I can't say when this library will be updated yet, though

MFlisar avatar Sep 13 '24 10:09 MFlisar

So far I'm done with this.

Here's some explanation on why I currently tag the release as pre release and compatibility with other libraries: https://github.com/MFlisar/compatibility/blob/main/readme.md

MFlisar avatar Jul 30 '25 16:07 MFlisar

I will only support android and jvm though - if a library is KMP only then it should work everywhere, if not, I can not provide an iOS implementation myself as I don't own a mac to make any tests nor do I have experience with native iOS coding yet...

Note that as of Kotlin 2.1.0 there is an experimental feature (that works well) that allows you to build klibs for iOS on non-Macs.

See https://kotlinlang.org/docs/whatsnew21.html#ability-to-publish-kotlin-libraries-from-any-host

dalewking avatar Jul 30 '25 17:07 dalewking

Thanks for the info - I did not know that. I tried to implement missing things in my libraries for iOS as well, it's mostly file access stuff only => this stuff is just untested though but implemented. Everything is build on a mac via github actions, so I do support iOS nearly everywhere...

MFlisar avatar Jul 30 '25 17:07 MFlisar

I'd be happy to test it if you need that support

dalewking avatar Jul 30 '25 17:07 dalewking

I test all my libraries on windows, wasm and android but iOS and mac is missing...

I plan to buy a mac mini at the beginning of next year and publish my first iOS app, but this is just planned so I don't know how fast I will really be. And help and confirmation that a library is working would be appreciated.

iOS tests

What would you offer? I would need help from setting up the demo app and testing it as I don't know how to set up the iOS demo... Testing alone would not be enough...

But to be honest, I would need to start with my 2 base libraries KotPreferences and Lumberjack - this library has modules for those 2 libraries so you could not confirm that this library works completely without confirming that the other 2 work...

MFlisar avatar Jul 30 '25 17:07 MFlisar

I just meant that if you can publish a library for iOS I will try it out to see if it is working.

You might want to investigate a testing farm instead of buying your own machine if you only need it for testing your libraries. Some have free tiers

I might be checking out LumberJack as we need a good logging framework.

We use https://github.com/russhwolf/multiplatform-settings so KotPreferences not useful to us

dalewking avatar Jul 30 '25 18:07 dalewking

this library is published for iOS so you could try it already...

MFlisar avatar Jul 30 '25 18:07 MFlisar

Seems to work for iOS, but a couple of notes:

  • Your example does not work for KMP. You used BuildConfig.DEBUG for enabling. There is no BuildConfig for KMP. For iOS there is no debug vs. release builds for iOS
  • It seems to support dragging from anywhere on the screen which could interfere with swiping in the normal UI, This may affect Android as well. Might be nice to support a tab on the side to pull out the debug drawer in only that place
Image

dalewking avatar Jul 30 '25 23:07 dalewking

Your example does not work for KMP. You used BuildConfig.DEBUG for enabling. There is no BuildConfig for KMP. For iOS there is no debug vs. release builds for iOS

I can only find BuildConfig.DEBUG in the android demo inside platform specific code... It's just an example, personally I never use it like that, I always have developer settings in my app and enable/disable the drawer there...

It seems to support dragging from anywhere on the screen which could interfere with swiping in the normal UI, This may affect Android as well. Might be nice to support a tab on the side to pull out the debug drawer in only that place

That's the same on all platforms - if the content is swipeable it does not interfere with it in my tests though and this is just how the ModalNavigationDrawer works. I do expose the drawers setup though so you can adjust it if desired:

https://github.com/MFlisar/ComposeDebugDrawer/blob/1b3f5f00067f6c32530787804ef069fa766aef62/library/core/src/commonMain/kotlin/com/michaelflisar/composedebugdrawer/core/DebugDrawer.kt#L98-L109

E.g. you can disable the gesture support via the gesturesEnabled if desired...

MFlisar avatar Aug 01 '25 10:08 MFlisar