Dhananjay Navlani
09/27/2024, 4:10 AMKhanzada Kashif
09/27/2024, 7:30 AM@Composable
fun YourComposableScreen() {}
you'll be able to use it directly in your android native side, but on ios you'll have to wrap it in ComposeUiViewContoller like this,
iosMain:
create a file named YourComposableScreenShared.kt
add this function in it
fun ComposableScreen() = ComposeUiViewController {
YourComposableScreen()
}
then you'll be able to use it in swift ui code like this.
import shared
struct PayWallScreen: View {
var body: some View {
VStack {
YourComposableScreenShared()
}
}
struct YourComposableScreenShared: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
let content = YourComposableScreenSharedKt.ComposableScreen()
return content
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
}
}
Dhananjay Navlani
09/27/2024, 7:31 AMKhanzada Kashif
09/27/2024, 7:32 AMDhananjay Navlani
09/27/2024, 7:33 AMKhanzada Kashif
09/27/2024, 7:34 AMDhananjay Navlani
09/27/2024, 7:34 AMKhanzada Kashif
09/27/2024, 7:35 AMDhananjay Navlani
09/27/2024, 7:39 AMKhanzada Kashif
09/27/2024, 7:43 AMid("org.jetbrains.compose")
then in common source set, you can add compose dependencies from this plugins as you need, for very basic you'll need these.
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.ui)
Khanzada Kashif
09/27/2024, 7:44 AMDhananjay Navlani
09/27/2024, 7:44 AMKhanzada Kashif
09/27/2024, 7:44 AMDhananjay Navlani
09/27/2024, 7:45 AMKhanzada Kashif
09/27/2024, 7:46 AMDhananjay Navlani
09/27/2024, 7:46 AMKhanzada Kashif
09/27/2024, 7:47 AM