diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts
index 3d6e766d..7e74ae51 100644
--- a/composeApp/build.gradle.kts
+++ b/composeApp/build.gradle.kts
@@ -41,7 +41,9 @@ kotlin {
implementation(compose.desktop.currentOs)
}
commonMain.dependencies {
- implementation(libs.kermit)
+ implementation(project(":core:core"))
+ implementation(project(":core:ui"))
+ implementation(project(":feature:home"))
implementation(projects.shared)
implementation(compose.runtime)
diff --git a/composeApp/src/commonMain/kotlin/App.kt b/composeApp/src/commonMain/kotlin/App.kt
index 73babd79..aa8a6b2b 100644
--- a/composeApp/src/commonMain/kotlin/App.kt
+++ b/composeApp/src/commonMain/kotlin/App.kt
@@ -1,5 +1,5 @@
import androidx.compose.runtime.Composable
-import org.jetbrains.compose.resources.ExperimentalResourceApi
+import com.stslex.core.ui.theme.AppTheme
@Composable
fun App() {
diff --git a/composeApp/src/commonMain/kotlin/InitialApp.kt b/composeApp/src/commonMain/kotlin/InitialApp.kt
index 6a076584..272a6384 100644
--- a/composeApp/src/commonMain/kotlin/InitialApp.kt
+++ b/composeApp/src/commonMain/kotlin/InitialApp.kt
@@ -1,61 +1,7 @@
-import androidx.compose.animation.AnimatedVisibility
-import androidx.compose.foundation.Image
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.material.Button
-import androidx.compose.material.MaterialTheme
-import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.derivedStateOf
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.setValue
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import org.jetbrains.compose.resources.ExperimentalResourceApi
-import org.jetbrains.compose.resources.painterResource
+import com.stslex.feature.home.HomeScreen
-@OptIn(ExperimentalResourceApi::class)
@Composable
fun InitialApp() {
- Box(
- modifier = Modifier
- .fillMaxSize()
- .background(MaterialTheme.colors.background)
- ) {
- val defaultGreetState = "Hello World!"
- val clickedGreetState = "Compose: ${Greeting().greet()}"
- var isClicked by remember { mutableStateOf(false) }
- val greetingText by remember {
- derivedStateOf {
- if (isClicked) {
- clickedGreetState
- } else {
- defaultGreetState
- }
- }
- }
- Column(
- modifier = Modifier.fillMaxWidth(),
- horizontalAlignment = Alignment.CenterHorizontally
- ) {
- Button(
- onClick = {
- isClicked = !isClicked
- }
- ) {
- Text(greetingText)
- }
- AnimatedVisibility(isClicked) {
- Image(
- painterResource("compose-multiplatform.xml"),
- null
- )
- }
- }
- }
+ HomeScreen()
}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/main_screen/MainScreen.kt b/composeApp/src/commonMain/kotlin/main_screen/MainScreen.kt
deleted file mode 100644
index e6443bfd..00000000
--- a/composeApp/src/commonMain/kotlin/main_screen/MainScreen.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package main_screen
-
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material.MaterialTheme
-import androidx.compose.material.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-
-@Composable
-fun MainScreen(
- modifier: Modifier = Modifier
-) {
- Box(
- modifier = modifier
- .fillMaxSize()
- .background(MaterialTheme.colors.background),
- contentAlignment = Alignment.Center
- ) {
- Text(text = "Main Screen")
- }
-}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/resources/compose-multiplatform.xml b/composeApp/src/commonMain/resources/compose-multiplatform.xml
deleted file mode 100644
index d7bf7955..00000000
--- a/composeApp/src/commonMain/resources/compose-multiplatform.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/core/core/build.gradle.kts b/core/core/build.gradle.kts
new file mode 100644
index 00000000..e3955751
--- /dev/null
+++ b/core/core/build.gradle.kts
@@ -0,0 +1,46 @@
+plugins {
+ alias(libs.plugins.kotlinMultiplatform)
+ alias(libs.plugins.androidLibrary)
+ alias(libs.plugins.jetbrainsCompose)
+}
+
+kotlin {
+ androidTarget {
+ compilations.all {
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+ }
+ }
+
+ listOf(
+ iosX64(),
+ iosArm64(),
+ iosSimulatorArm64()
+ ).forEach {
+ it.binaries.framework {
+ baseName = "core"
+ isStatic = true
+ }
+ }
+
+ sourceSets {
+ commonMain.dependencies {
+ implementation(libs.kermit)
+ implementation(projects.shared)
+ implementation(compose.runtime)
+ implementation(compose.foundation)
+ }
+ commonTest.dependencies {
+ implementation(libs.kotlin.test)
+ }
+ }
+}
+
+android {
+ namespace = "com.stslex.core.core"
+ compileSdk = libs.versions.android.compileSdk.get().toInt()
+ defaultConfig {
+ minSdk = libs.versions.android.minSdk.get().toInt()
+ }
+}
diff --git a/composeApp/src/commonMain/kotlin/core/AppDispatcher.kt b/core/core/src/commonMain/kotlin/com/stslex/core/core/AppDispatcher.kt
similarity index 81%
rename from composeApp/src/commonMain/kotlin/core/AppDispatcher.kt
rename to core/core/src/commonMain/kotlin/com/stslex/core/core/AppDispatcher.kt
index 973b9ddd..b3230f93 100644
--- a/composeApp/src/commonMain/kotlin/core/AppDispatcher.kt
+++ b/core/core/src/commonMain/kotlin/com/stslex/core/core/AppDispatcher.kt
@@ -1,8 +1,7 @@
-package core
+package com.stslex.core.core
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.IO
import kotlinx.coroutines.MainCoroutineDispatcher
interface AppDispatcher {
@@ -12,7 +11,7 @@ interface AppDispatcher {
}
class AppDispatcherImpl : AppDispatcher {
- override val io: CoroutineDispatcher = Dispatchers.IO
+ override val io: CoroutineDispatcher = Dispatchers.Default // TODO IO
override val main: MainCoroutineDispatcher = Dispatchers.Main
override val default: CoroutineDispatcher = Dispatchers.Default
}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/core/CommonUtils.kt b/core/core/src/commonMain/kotlin/com/stslex/core/core/CommonUtils.kt
similarity index 84%
rename from composeApp/src/commonMain/kotlin/core/CommonUtils.kt
rename to core/core/src/commonMain/kotlin/com/stslex/core/core/CommonUtils.kt
index 056973a2..4ad5199e 100644
--- a/composeApp/src/commonMain/kotlin/core/CommonUtils.kt
+++ b/core/core/src/commonMain/kotlin/com/stslex/core/core/CommonUtils.kt
@@ -1,4 +1,4 @@
-package core
+package com.stslex.core.core
import kotlinx.coroutines.CoroutineExceptionHandler
diff --git a/composeApp/src/commonMain/kotlin/core/Logger.kt b/core/core/src/commonMain/kotlin/com/stslex/core/core/Logger.kt
similarity index 96%
rename from composeApp/src/commonMain/kotlin/core/Logger.kt
rename to core/core/src/commonMain/kotlin/com/stslex/core/core/Logger.kt
index 5e04aca9..01b2c613 100644
--- a/composeApp/src/commonMain/kotlin/core/Logger.kt
+++ b/core/core/src/commonMain/kotlin/com/stslex/core/core/Logger.kt
@@ -1,4 +1,4 @@
-package core
+package com.stslex.core.core
import co.touchlab.kermit.Logger as Log
diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts
new file mode 100644
index 00000000..95919e1b
--- /dev/null
+++ b/core/ui/build.gradle.kts
@@ -0,0 +1,52 @@
+import org.jetbrains.compose.ExperimentalComposeLibrary
+
+plugins {
+ alias(libs.plugins.kotlinMultiplatform)
+ alias(libs.plugins.androidLibrary)
+ alias(libs.plugins.jetbrainsCompose)
+}
+
+kotlin {
+ androidTarget {
+ compilations.all {
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+ }
+ }
+
+ listOf(
+ iosX64(),
+ iosArm64(),
+ iosSimulatorArm64()
+ ).forEach {
+ it.binaries.framework {
+ baseName = "ui"
+ isStatic = true
+ }
+ }
+
+ sourceSets {
+ commonMain.dependencies {
+ implementation(project(":core:core"))
+
+ implementation(projects.shared)
+ implementation(compose.runtime)
+ implementation(compose.foundation)
+ implementation(compose.material)
+ @OptIn(ExperimentalComposeLibrary::class)
+ implementation(compose.components.resources)
+ }
+ commonTest.dependencies {
+ implementation(libs.kotlin.test)
+ }
+ }
+}
+
+android {
+ namespace = "com.stslex.core.ui"
+ compileSdk = libs.versions.android.compileSdk.get().toInt()
+ defaultConfig {
+ minSdk = libs.versions.android.minSdk.get().toInt()
+ }
+}
diff --git a/composeApp/src/commonMain/kotlin/store/BaseStore.kt b/core/ui/src/commonMain/kotlin/com/stslex/core/ui/mvi/BaseStore.kt
similarity index 86%
rename from composeApp/src/commonMain/kotlin/store/BaseStore.kt
rename to core/ui/src/commonMain/kotlin/com/stslex/core/ui/mvi/BaseStore.kt
index c1892728..41e525e8 100644
--- a/composeApp/src/commonMain/kotlin/store/BaseStore.kt
+++ b/core/ui/src/commonMain/kotlin/com/stslex/core/ui/mvi/BaseStore.kt
@@ -1,8 +1,13 @@
-package store
+package com.stslex.core.ui.mvi
-import core.AppDispatcher
-import core.Logger
-import core.coroutineExceptionHandler
+import com.stslex.core.core.AppDispatcher
+import com.stslex.core.core.Logger
+import com.stslex.core.core.coroutineExceptionHandler
+import com.stslex.core.ui.navigation.Router
+import com.stslex.core.ui.mvi.Store.Action
+import com.stslex.core.ui.mvi.Store.Event
+import com.stslex.core.ui.mvi.Store.Navigation
+import com.stslex.core.ui.mvi.Store.State
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
@@ -16,11 +21,6 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
-import st.slex.csplashscreen.core.ui.mvi.Router
-import st.slex.csplashscreen.core.ui.mvi.Store.Action
-import st.slex.csplashscreen.core.ui.mvi.Store.Event
-import st.slex.csplashscreen.core.ui.mvi.Store.Navigation
-import st.slex.csplashscreen.core.ui.mvi.Store.State
abstract class BaseStore(
private val router: Router,
diff --git a/composeApp/src/commonMain/kotlin/store/Store.kt b/core/ui/src/commonMain/kotlin/com/stslex/core/ui/mvi/Store.kt
similarity index 72%
rename from composeApp/src/commonMain/kotlin/store/Store.kt
rename to core/ui/src/commonMain/kotlin/com/stslex/core/ui/mvi/Store.kt
index a3117d6b..44fc4319 100644
--- a/composeApp/src/commonMain/kotlin/store/Store.kt
+++ b/core/ui/src/commonMain/kotlin/com/stslex/core/ui/mvi/Store.kt
@@ -1,4 +1,4 @@
-package st.slex.csplashscreen.core.ui.mvi
+package com.stslex.core.ui.mvi
interface Store {
diff --git a/composeApp/src/commonMain/kotlin/store/Router.kt b/core/ui/src/commonMain/kotlin/com/stslex/core/ui/navigation/Router.kt
similarity index 52%
rename from composeApp/src/commonMain/kotlin/store/Router.kt
rename to core/ui/src/commonMain/kotlin/com/stslex/core/ui/navigation/Router.kt
index 4763faa2..bd22011c 100644
--- a/composeApp/src/commonMain/kotlin/store/Router.kt
+++ b/core/ui/src/commonMain/kotlin/com/stslex/core/ui/navigation/Router.kt
@@ -1,4 +1,6 @@
-package st.slex.csplashscreen.core.ui.mvi
+package com.stslex.core.ui.navigation
+
+import com.stslex.core.ui.mvi.Store
fun interface Router {
operator fun invoke(event: E)
diff --git a/composeApp/src/commonMain/kotlin/AppTheme.kt b/core/ui/src/commonMain/kotlin/com/stslex/core/ui/theme/AppTheme.kt
similarity index 93%
rename from composeApp/src/commonMain/kotlin/AppTheme.kt
rename to core/ui/src/commonMain/kotlin/com/stslex/core/ui/theme/AppTheme.kt
index 89e9d566..b316513b 100644
--- a/composeApp/src/commonMain/kotlin/AppTheme.kt
+++ b/core/ui/src/commonMain/kotlin/com/stslex/core/ui/theme/AppTheme.kt
@@ -1,3 +1,5 @@
+package com.stslex.core.ui.theme
+
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
import androidx.compose.material.darkColors
diff --git a/feature/home/build.gradle.kts b/feature/home/build.gradle.kts
new file mode 100644
index 00000000..3098c728
--- /dev/null
+++ b/feature/home/build.gradle.kts
@@ -0,0 +1,53 @@
+import org.jetbrains.compose.ExperimentalComposeLibrary
+
+plugins {
+ alias(libs.plugins.kotlinMultiplatform)
+ alias(libs.plugins.androidLibrary)
+ alias(libs.plugins.jetbrainsCompose)
+}
+
+kotlin {
+ androidTarget {
+ compilations.all {
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+ }
+ }
+
+ listOf(
+ iosX64(),
+ iosArm64(),
+ iosSimulatorArm64()
+ ).forEach {
+ it.binaries.framework {
+ baseName = "home"
+ isStatic = true
+ }
+ }
+
+ sourceSets {
+ commonMain.dependencies {
+ implementation(project(":core:core"))
+ implementation(project(":core:ui"))
+
+ implementation(projects.shared)
+ implementation(compose.runtime)
+ implementation(compose.foundation)
+ implementation(compose.material)
+ @OptIn(ExperimentalComposeLibrary::class)
+ implementation(compose.components.resources)
+ }
+ commonTest.dependencies {
+ implementation(libs.kotlin.test)
+ }
+ }
+}
+
+android {
+ namespace = "com.stslex.feature.home"
+ compileSdk = libs.versions.android.compileSdk.get().toInt()
+ defaultConfig {
+ minSdk = libs.versions.android.minSdk.get().toInt()
+ }
+}
diff --git a/feature/home/src/commonMain/kotlin/com/stslex/feature/home/HomeScreen.kt b/feature/home/src/commonMain/kotlin/com/stslex/feature/home/HomeScreen.kt
new file mode 100644
index 00000000..6ae61bad
--- /dev/null
+++ b/feature/home/src/commonMain/kotlin/com/stslex/feature/home/HomeScreen.kt
@@ -0,0 +1,65 @@
+package com.stslex.feature.home
+
+import Greeting
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.material.Button
+import androidx.compose.material.MaterialTheme
+import androidx.compose.material.Text
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Home
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.derivedStateOf
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+
+@Composable
+fun HomeScreen(
+ modifier: Modifier = Modifier
+) {
+ Box(
+ modifier = modifier
+ .fillMaxSize()
+ .background(MaterialTheme.colors.background)
+ ) {
+ val defaultGreetState = "Hello World!"
+ val clickedGreetState = "Compose: ${Greeting().greet()}"
+ var isClicked by remember { mutableStateOf(false) }
+ val greetingText by remember {
+ derivedStateOf {
+ if (isClicked) {
+ clickedGreetState
+ } else {
+ defaultGreetState
+ }
+ }
+ }
+ Column(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalAlignment = Alignment.CenterHorizontally
+ ) {
+ Button(
+ onClick = {
+ isClicked = !isClicked
+ }
+ ) {
+ Text(greetingText)
+ }
+ AnimatedVisibility(isClicked) {
+ Image(
+ Icons.Default.Home,
+ null
+ )
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/settings.gradle.kts b/settings.gradle.kts
index fb96de02..239c3fa5 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -21,5 +21,6 @@ dependencyResolutionManagement {
include(":server")
include(":shared")
include(":composeApp")
-include(":core")
-include(":home")
+include(":core:core")
+include(":core:ui")
+include(":feature:home")