Skip to content

Commit 41c5f33

Browse files
author
eshc123
committed
FEAT: NavHost 구현
1 parent 51160cb commit 41c5f33

File tree

9 files changed

+64
-7
lines changed

9 files changed

+64
-7
lines changed

build-logic/convention/src/main/kotlin/FeatureConventionPlugin.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class FeatureConventionPlugin: Plugin<Project> {
2626
dependencies {
2727
add("implementation", project(":core:domain"))
2828
add("implementation", project(":core:ui"))
29+
add("implementation", project(":core:ui-navigation"))
2930
add("implementation", project(":core:designsystem"))
3031

3132
add("implementation", libs.findLibrary("core.ktx").get())

core/ui-navigation/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
plugins {
22
alias(libs.plugins.tuk.android.library)
3+
alias(libs.plugins.kotlinx.serialization.plugin)
34
}
45

56
android {
67
namespace = "com.plottwist.core.ui.navigation"
78
}
89

910
dependencies {
10-
implementation(libs.core.ktx)
11-
implementation(libs.appcompat)
12-
implementation(libs.material)
11+
implementation(libs.kotlinx.serialization)
1312
testImplementation(libs.junit)
1413
androidTestImplementation(libs.androidx.test.ext.junit)
1514
androidTestImplementation(libs.espresso.core)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.plottwist.core.ui.navigation
2+
3+
import kotlinx.serialization.Serializable
4+
5+
6+
sealed interface Route {
7+
8+
@Serializable
9+
data object Home: Route
10+
}

feature/home/src/main/java/com/plottwist/feature/home/.gitkeep

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.plottwist.feature.home
2+
3+
import androidx.compose.material3.Text
4+
import androidx.compose.runtime.Composable
5+
import androidx.compose.ui.Modifier
6+
7+
@Composable
8+
fun HomeScreen(
9+
modifier: Modifier = Modifier
10+
) {
11+
Text(text = "")
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.plottwist.feature.home.navigation
2+
3+
import androidx.navigation.NavGraphBuilder
4+
import androidx.navigation.compose.composable
5+
import com.plottwist.core.ui.navigation.Route
6+
import com.plottwist.feature.home.HomeScreen
7+
8+
fun NavGraphBuilder.homeNavGraph() {
9+
composable<Route.Home> {
10+
HomeScreen()
11+
}
12+
}

feature/main/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ android {
88
}
99

1010
dependencies {
11+
implementation(project(":feature:home"))
1112
testImplementation(libs.junit)
1213
androidTestImplementation(libs.androidx.test.ext.junit)
1314
androidTestImplementation(libs.espresso.core)

feature/main/src/main/java/com/plottwist/feature/main/TukApp.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package com.plottwist.feature.main
33
import androidx.compose.foundation.layout.fillMaxSize
44
import androidx.compose.foundation.layout.padding
55
import androidx.compose.material3.Scaffold
6-
import androidx.compose.material3.Text
76
import androidx.compose.runtime.Composable
87
import androidx.compose.ui.Modifier
8+
import com.plottwist.feature.main.ui.component.TukNavHost
99

1010
@Composable
1111
fun TukApp(
@@ -14,9 +14,8 @@ fun TukApp(
1414
Scaffold(
1515
modifier = modifier.fillMaxSize()
1616
) { innerPadding ->
17-
Text(
18-
modifier = Modifier.padding(innerPadding),
19-
text = "Tuk"
17+
TukNavHost(
18+
modifier = Modifier.padding(innerPadding)
2019
)
2120
}
2221
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.plottwist.feature.main.ui.component
2+
3+
import androidx.compose.runtime.Composable
4+
import androidx.compose.ui.Modifier
5+
import androidx.navigation.NavHostController
6+
import androidx.navigation.compose.NavHost
7+
import androidx.navigation.compose.rememberNavController
8+
import com.plottwist.core.ui.navigation.Route
9+
import com.plottwist.feature.home.navigation.homeNavGraph
10+
11+
@Composable
12+
fun TukNavHost(
13+
modifier: Modifier = Modifier,
14+
navController: NavHostController = rememberNavController()
15+
) {
16+
NavHost(
17+
modifier = modifier,
18+
navController = navController,
19+
startDestination = Route.Home
20+
) {
21+
homeNavGraph()
22+
}
23+
}

0 commit comments

Comments
 (0)