Hi, I am using compose-multiplatform and I wonder ...
# compose-ios
j
Hi, I am using compose-multiplatform and I wonder how to figure out whats available for commonMain. E.g I thought that AlertDialog would be available for both platforms iOS/Android, but it seems that its not. On the other side NavigationRail seems to be available in commonMain. Is there a guide/overview what is supported?
n
It is easier to list what is not supported. We ported JetPack Compose (runtime, ui, foundation, animation, material, material 3) except some too Android specific parts. As you mentioned, dialogs are not supported yet and you can't use Android resources. For resources we provide a replacement multiplatform library (that is included by default in our official template project) though it's functionality should be extended. There are some libraries in androidx that are not part of Compose but based on Compose that are not ported to Compose Multiplatform: androidx.navigation, androidx.paging, androidx.constraintlayout, androidx.lifecycle, androidx.tv.
j
ok, thanks for the info. I just have to ask now, cause you responded, but will there be a new compose-multiplatform release soon be available? The last one (1.4.0) is already a couple of weeks ago ...
don't get me wrong ... don't want to complain by saying "couple of weeks" ... just want to know the tension
m
You could try 1.5.0-dev1043.
k
For resources we provide a replacement multiplatform library (that is included by default in our official template project)
@Nikita Lipsky Great!! Which repository is the sample that uses this library?
i
a new compose-multiplatform release soon be available
The current strategy is to follow main releases of Jetpack Compose and release 1-2 months Compose Multiplatform after that based on the released version of Jetpack Compose. If there was a hotfix version of Jetpack Compose released, there can also be a hotfix of Compose Multiplatform released after that, but we don’t guarantee that it will be released fast, or even released at all. It depends on severity of the fixes and how much they affect iOS/desktop/web. A hotfix of Compose Multiplatform can also be released independently of Jetpack Compose if we need fixes for iOS/desktop/web only.
j
ah, yes sorry ... I read about this somewhere else. Now I know again
n
m
I've implemented dialogs from scratch in my dialog library if you want to use it https://github.com/Syer10/compose-material-dialogs
j
@Mitchell Syer I have problems adding your dialog library to my compose-multiplatform project (iOS/Android). I have added
implementation ("io.github.vanpra.compose-material-dialogs:core:0.9.0")
to commonMain of my shared-module. Gradle sync completed successfully. Afterwards I tried to create a basic dialog to my AppContent-Composable defined in my commonMain.
Copy code
val dialogState = rememberMaterialDialogState()
        MaterialDialog(dialogState = dialogState) {
            title(text = "Use Location Services?")
            message(res = R.string.location_dialog_message)
        }

        /* This should be called in an onClick or an Effect */
        dialog.show()
Unfortunately its already failing to find the correct imports. What am I doing wrong?
m
@Jan The latest version is 0.9.3, make sure your using that. Also my version of the library does not support direct Res parameters, so you need to use
message(text = stringResource(R.string.location_dialog_message)).
Another thing is in that code it would use
dialogState.show()
, not
dialog.show()
j
Hm, ok I think the documentation is just outdated. I used this site https://vanpra.github.io/compose-material-dialogs/ and implemented
Copy code
implementation "io.github.vanpra.compose-material-dialogs:core:0.9.3"
instead of
Copy code
implementation "ca.gosyer:compose-material-dialogs-datetime:0.9.3"
sorry, did miss that its a fork ...
@Mitchell Syer is it normal that there is no modal behind the alert? I can only see it while I rotate the device
image.png
looks like its an issue with my emulator
nope, its related to android os version. I hope its due Android 14 Beta ...