Compose Multiplatform Mobile project template

This commit is contained in:
Nikita Lipsky
2023-03-23 15:44:18 +04:00
commit a133881345
44 changed files with 1730 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@@ -0,0 +1,5 @@
import androidx.compose.runtime.Composable
actual fun getPlatformName(): String = "Android"
@Composable fun MainView() = App()

View File

@@ -0,0 +1,23 @@
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@Composable
internal fun App() {
MaterialTheme {
var text by remember { mutableStateOf("Hello, World!") }
Button(onClick = {
text = "Hello, ${getPlatformName()}"
}) {
Text(text)
}
}
}
expect fun getPlatformName(): String

View File

@@ -0,0 +1,5 @@
import androidx.compose.ui.window.ComposeUIViewController
actual fun getPlatformName(): String = "iOS"
fun MainViewController() = ComposeUIViewController { App() }