├── .gitignore
├── LICENSE
├── README.MD
├── build.gradle.kts
├── composeApp
├── build.gradle.kts
└── src
│ ├── androidMain
│ ├── AndroidManifest.xml
│ └── kotlin
│ │ └── com
│ │ └── kashif
│ │ └── sample
│ │ ├── App.android.kt
│ │ ├── theme
│ │ └── Theme.android.kt
│ │ └── voyager
│ │ └── VoyagerExtension.android.kt
│ ├── commonMain
│ ├── composeResources
│ │ ├── drawable
│ │ │ ├── ic_cyclone.xml
│ │ │ ├── ic_dark_mode.xml
│ │ │ ├── ic_light_mode.xml
│ │ │ └── ic_rotate_right.xml
│ │ ├── font
│ │ │ └── IndieFlower-Regular.ttf
│ │ └── values
│ │ │ └── strings.xml
│ └── kotlin
│ │ └── com
│ │ └── kashif
│ │ └── sample
│ │ ├── App.kt
│ │ ├── theme
│ │ ├── Color.kt
│ │ └── Theme.kt
│ │ └── voyager
│ │ └── VoyagerExtension.kt
│ ├── commonTest
│ └── kotlin
│ │ └── com
│ │ └── kashif
│ │ └── sample
│ │ └── ComposeTest.kt
│ └── iosMain
│ └── kotlin
│ ├── com
│ └── kashif
│ │ └── sample
│ │ ├── theme
│ │ └── Theme.ios.kt
│ │ └── voyager
│ │ ├── UIViewControllerWrapper.kt
│ │ ├── ViewcontrollerExtensions.kt
│ │ └── VoyagerExtension.ios.kt
│ └── main.kt
├── gradle.properties
├── gradle
├── libs.versions.toml
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── iosApp
├── iosApp.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ │ └── contents.xcworkspacedata
└── iosApp
│ ├── Assets.xcassets
│ ├── AccentColor.colorset
│ │ └── Contents.json
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── Contents.json
│ ├── Info.plist
│ ├── Preview Content
│ └── Preview Assets.xcassets
│ │ └── Contents.json
│ └── iosApp.swift
└── settings.gradle.kts
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | *.iml
3 | .gradle
4 | .idea
5 | .kotlin
6 | .DS_Store
7 | build
8 | */build
9 | captures
10 | .externalNativeBuild
11 | .cxx
12 | local.properties
13 | xcuserdata/
14 | Pods/
15 | *.jks
16 | *yarn.lock
17 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Kashif Mehmood
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.MD:
--------------------------------------------------------------------------------
1 | # Compose Multiplatform Application with IOS native Navigation for IOS App in common code and Voyager for other platforms
2 | - use voyant to get started without any boilerplater [Voyant](https://github.com/kashif-e/voyant) for using ios navigation with CMP
3 | - Looking to build with KMP and CMP? Let's connect [LinkedIn](https://www.linkedin.com/in/kashif-mehmood-km/)
4 | - Featured in [Kotlin Weekly](https://mailchi.mp/kotlinweekly/kotlin-weekly-422)
5 |
6 | #### Want to support my work ?
7 |
8 |
9 |
10 |
11 | ## Experiment: iOS Navigation with Compose Multiplatform 🔴🚧⌛🔄🟢
12 |
13 | This project is an experiment to explore how iOS navigation can be implemented using Compose Multiplatform. The goal is to leverage Kotlin Multiplatform capabilities to create a seamless navigation experience on both Android and iOS platforms.
14 |
15 | ### How It Works
16 |
17 | 1. **Navigation Setup**:
18 | - The `Navigator` class is used to manage navigation between different screens.
19 | - The `BottomSheetNavigator` is used to handle bottom sheet navigation.
20 |
21 | 2. **View Controller Wrapping**:
22 | - The `extendedComposeViewController` function creates a `UIViewController` that hosts a Compose UI.
23 | - The `UIViewControllerWrapper` class wraps another `UIViewController` and adds gesture recognizer functionality to handle swipe gestures.
24 |
25 | 3. **Gesture Handling**:
26 | - The `UIViewControllerWrapper` implements the `UIGestureRecognizerDelegateProtocol` to handle swipe gestures.
27 | - Swipe gestures are added to the view controller to enable navigation through swiping.
28 |
29 | 4. **Interactive Pop Gesture**:
30 | - The `interactivePopGestureRecognizer` is enabled for the entire screen to allow swipe-back navigation.
31 | - The delegate for the `interactivePopGestureRecognizer` is set to the `UIViewControllerWrapper` to manage the gesture.
32 |
33 | ## Demo
34 | [](https://www.youtube.com/shorts/HdPoG59DYws)
35 |
36 |
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | alias(libs.plugins.multiplatform).apply(false)
3 | alias(libs.plugins.compose.compiler).apply(false)
4 | alias(libs.plugins.compose).apply(false)
5 | alias(libs.plugins.android.application).apply(false)
6 | }
7 |
--------------------------------------------------------------------------------
/composeApp/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import org.jetbrains.compose.ExperimentalComposeLibrary
2 | import com.android.build.api.dsl.ManagedVirtualDevice
3 | import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
4 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget
5 | import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
6 |
7 | plugins {
8 | alias(libs.plugins.multiplatform)
9 | alias(libs.plugins.compose.compiler)
10 | alias(libs.plugins.compose)
11 | alias(libs.plugins.android.application)
12 | }
13 |
14 | kotlin {
15 | androidTarget {
16 | compilations.all {
17 | compileTaskProvider {
18 | compilerOptions {
19 | jvmTarget.set(JvmTarget.JVM_1_8)
20 | //https://jakewharton.com/gradle-toolchains-are-rarely-a-good-idea/#what-do-i-do
21 | freeCompilerArgs.add("-Xjdk-release=${JavaVersion.VERSION_1_8}")
22 | }
23 | }
24 | }
25 | //https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-test.html
26 | @OptIn(ExperimentalKotlinGradlePluginApi::class)
27 | instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
28 | }
29 |
30 | listOf(
31 | iosX64(),
32 | iosArm64(),
33 | iosSimulatorArm64()
34 | ).forEach {
35 | it.binaries.framework {
36 | baseName = "ComposeApp"
37 | isStatic = true
38 | }
39 | }
40 |
41 | sourceSets {
42 | commonMain.dependencies {
43 | implementation(compose.runtime)
44 | implementation(compose.foundation)
45 | implementation(compose.material3)
46 | implementation(compose.material)
47 | implementation(compose.components.resources)
48 | implementation(compose.components.uiToolingPreview)
49 | implementation(libs.voyager.navigator)
50 | implementation("cafe.adriel.voyager:voyager-bottom-sheet-navigator:1.1.0-beta02")
51 | implementation(libs.napier)
52 | }
53 |
54 | commonTest.dependencies {
55 | implementation(kotlin("test"))
56 | @OptIn(ExperimentalComposeLibrary::class)
57 | implementation(compose.uiTest)
58 | }
59 |
60 | androidMain.dependencies {
61 | implementation(compose.uiTooling)
62 | implementation(libs.androidx.activityCompose)
63 | }
64 |
65 | iosMain.dependencies {
66 | }
67 |
68 | }
69 | }
70 |
71 | android {
72 | namespace = "com.kashif.sample"
73 | compileSdk = 34
74 |
75 | defaultConfig {
76 | minSdk = 26
77 | targetSdk = 34
78 |
79 | applicationId = "com.kashif.sample.androidApp"
80 | versionCode = 1
81 | versionName = "1.0.0"
82 |
83 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
84 | }
85 | //https://developer.android.com/studio/test/gradle-managed-devices
86 | @Suppress("UnstableApiUsage")
87 | testOptions {
88 | managedDevices.devices {
89 | maybeCreate("pixel5").apply {
90 | device = "Pixel 5"
91 | apiLevel = 34
92 | systemImageSource = "aosp"
93 | }
94 | }
95 | }
96 | compileOptions {
97 | sourceCompatibility = JavaVersion.VERSION_1_8
98 | targetCompatibility = JavaVersion.VERSION_1_8
99 | }
100 | }
101 |
102 | //https://developer.android.com/develop/ui/compose/testing#setup
103 | dependencies {
104 | androidTestImplementation(libs.androidx.uitest.junit4)
105 | debugImplementation(libs.androidx.uitest.testManifest)
106 | //temporary fix: https://youtrack.jetbrains.com/issue/CMP-5864
107 | androidTestImplementation("androidx.test:monitor") {
108 | version { strictly("1.6.1") }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/kotlin/com/kashif/sample/App.android.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample
2 |
3 | import android.os.Bundle
4 | import androidx.activity.ComponentActivity
5 | import androidx.activity.compose.setContent
6 | import androidx.activity.enableEdgeToEdge
7 | import androidx.compose.runtime.Composable
8 | import androidx.compose.ui.tooling.preview.Preview
9 |
10 | class AppActivity : ComponentActivity() {
11 | override fun onCreate(savedInstanceState: Bundle?) {
12 | super.onCreate(savedInstanceState)
13 | enableEdgeToEdge()
14 | setContent { App() }
15 | }
16 | }
17 |
18 | @Preview
19 | @Composable
20 | fun AppPreview() { App() }
21 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/kotlin/com/kashif/sample/theme/Theme.android.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample.theme
2 |
3 | import android.app.Activity
4 | import androidx.compose.runtime.Composable
5 | import androidx.compose.runtime.LaunchedEffect
6 | import androidx.compose.ui.platform.LocalView
7 | import androidx.core.view.WindowInsetsControllerCompat
8 |
9 | @Composable
10 | internal actual fun SystemAppearance(isDark: Boolean) {
11 | val view = LocalView.current
12 | LaunchedEffect(isDark) {
13 | val window = (view.context as Activity).window
14 | WindowInsetsControllerCompat(window, window.decorView).apply {
15 | isAppearanceLightStatusBars = isDark
16 | isAppearanceLightNavigationBars = isDark
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/composeApp/src/androidMain/kotlin/com/kashif/sample/voyager/VoyagerExtension.android.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample.voyager
2 |
3 | import cafe.adriel.voyager.core.screen.Screen
4 | import cafe.adriel.voyager.navigator.Navigator
5 | import cafe.adriel.voyager.navigator.bottomSheet.BottomSheetNavigator
6 |
7 | actual fun Navigator.popX() {
8 | pop()
9 | }
10 |
11 | actual fun Navigator.popToRootX() {
12 | popUntilRoot()
13 | }
14 |
15 | actual fun Navigator.pushX(screen: Screen) {
16 | push(screen)
17 | }
18 |
19 | actual fun BottomSheetNavigator.hideX() {
20 | hide()
21 | }
22 |
23 | actual fun BottomSheetNavigator.showX(screen: Screen) {
24 | show(screen)
25 | }
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/drawable/ic_cyclone.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/drawable/ic_dark_mode.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/drawable/ic_light_mode.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/drawable/ic_rotate_right.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/font/IndieFlower-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kashif-E/Native-Ios-Navigation-Compose-Multiplatform/460e7b4317a28d08ea35db1dfb0d14e8da40acca/composeApp/src/commonMain/composeResources/font/IndieFlower-Regular.ttf
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Cyclone
3 | Open github
4 | Run
5 | Stop
6 | Theme
7 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/com/kashif/sample/App.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample
2 |
3 | import androidx.compose.animation.core.*
4 | import androidx.compose.foundation.Image
5 | import androidx.compose.foundation.layout.*
6 | import androidx.compose.material.ExperimentalMaterialApi
7 | import androidx.compose.material3.*
8 | import androidx.compose.runtime.*
9 | import androidx.compose.ui.Alignment
10 | import androidx.compose.ui.Modifier
11 | import androidx.compose.ui.draw.rotate
12 | import androidx.compose.ui.graphics.ColorFilter
13 | import androidx.compose.ui.platform.LocalUriHandler
14 | import androidx.compose.ui.text.font.FontFamily
15 | import androidx.compose.ui.unit.dp
16 | import cafe.adriel.voyager.core.screen.Screen
17 | import cafe.adriel.voyager.navigator.LocalNavigator
18 | import cafe.adriel.voyager.navigator.Navigator
19 | import cafe.adriel.voyager.navigator.bottomSheet.BottomSheetNavigator
20 | import cafe.adriel.voyager.navigator.bottomSheet.LocalBottomSheetNavigator
21 | import cafe.adriel.voyager.navigator.currentOrThrow
22 | import iosnavigationincomposemultiplatform.composeapp.generated.resources.*
23 | import com.kashif.sample.theme.AppTheme
24 | import com.kashif.sample.theme.LocalThemeIsDark
25 | import com.kashif.sample.voyager.hideX
26 | import com.kashif.sample.voyager.popToRootX
27 | import com.kashif.sample.voyager.popX
28 | import com.kashif.sample.voyager.pushX
29 | import com.kashif.sample.voyager.showX
30 | import kotlinx.coroutines.isActive
31 | import org.jetbrains.compose.resources.Font
32 | import org.jetbrains.compose.resources.stringResource
33 | import org.jetbrains.compose.resources.vectorResource
34 |
35 | @OptIn(ExperimentalMaterialApi::class)
36 | @Composable
37 | internal fun App() = AppTheme {
38 | BottomSheetNavigator {
39 | Navigator(ScreenA())
40 | }
41 | }
42 |
43 | class ScreenA : Screen {
44 | @Composable
45 | override fun Content() {
46 | val navigator = LocalNavigator.currentOrThrow
47 | Column(
48 | modifier = Modifier
49 | .fillMaxSize()
50 | .windowInsetsPadding(WindowInsets.safeDrawing)
51 | .padding(16.dp),
52 | horizontalAlignment = Alignment.CenterHorizontally
53 | ) {
54 | Text(
55 | text = stringResource(Res.string.cyclone),
56 | fontFamily = FontFamily(Font(Res.font.IndieFlower_Regular)),
57 | style = MaterialTheme.typography.displayLarge
58 | )
59 |
60 | var isRotating by remember { mutableStateOf(false) }
61 |
62 | val rotate = remember { Animatable(0f) }
63 | val target = 360f
64 | if (isRotating) {
65 | LaunchedEffect(Unit) {
66 | while (isActive) {
67 | val remaining = (target - rotate.value) / target
68 | rotate.animateTo(
69 | target,
70 | animationSpec = tween(
71 | (1_000 * remaining).toInt(),
72 | easing = LinearEasing
73 | )
74 | )
75 | rotate.snapTo(0f)
76 | }
77 | }
78 | }
79 |
80 | Image(
81 | modifier = Modifier
82 | .size(250.dp)
83 | .padding(16.dp)
84 | .run { rotate(rotate.value) },
85 | imageVector = vectorResource(Res.drawable.ic_cyclone),
86 | colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
87 | contentDescription = null
88 | )
89 |
90 | ElevatedButton(
91 | modifier = Modifier
92 | .padding(horizontal = 8.dp, vertical = 4.dp)
93 | .widthIn(min = 200.dp),
94 | onClick = { isRotating = !isRotating },
95 | content = {
96 | Icon(vectorResource(Res.drawable.ic_rotate_right), contentDescription = null)
97 | Spacer(Modifier.size(ButtonDefaults.IconSpacing))
98 | Text(
99 | stringResource(if (isRotating) Res.string.stop else Res.string.run)
100 | )
101 | }
102 | )
103 |
104 | var isDark by LocalThemeIsDark.current
105 | val icon = remember(isDark) {
106 | if (isDark) Res.drawable.ic_light_mode
107 | else Res.drawable.ic_dark_mode
108 | }
109 |
110 | ElevatedButton(
111 | modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)
112 | .widthIn(min = 200.dp),
113 | onClick = { isDark = !isDark },
114 | content = {
115 | Icon(vectorResource(icon), contentDescription = null)
116 | Spacer(Modifier.size(ButtonDefaults.IconSpacing))
117 | Text(stringResource(Res.string.theme))
118 | }
119 | )
120 |
121 | val uriHandler = LocalUriHandler.current
122 | TextButton(
123 | modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)
124 | .widthIn(min = 200.dp),
125 | onClick = { uriHandler.openUri("https://github.com/terrakok") },
126 | ) {
127 | Text(stringResource(Res.string.open_github))
128 | }
129 |
130 | Button(
131 | onClick = { navigator.pushX(ScreenB()) },
132 | content = { Text("Go to Screen B") }
133 | )
134 | }
135 | }
136 | }
137 |
138 | class ScreenB : Screen {
139 | @Composable
140 | override fun Content() {
141 | val navigator = LocalNavigator.currentOrThrow
142 | Column(
143 | modifier = Modifier.fillMaxSize(),
144 | verticalArrangement = Arrangement.Center,
145 | horizontalAlignment = Alignment.CenterHorizontally
146 | ) {
147 | Text(
148 | text ="Screen B",
149 | style = MaterialTheme.typography.headlineSmall
150 | )
151 | Button(
152 | onClick = { navigator.pushX(screen = ScreenC()) },
153 | content = { Text("Go to Screen C") }
154 | )
155 | }
156 | }
157 | }
158 |
159 | class ScreenC : Screen {
160 | @Composable
161 | override fun Content() {
162 | val navigator = LocalNavigator.currentOrThrow
163 | val bottomSheetNavigator = LocalBottomSheetNavigator.current
164 | Column(
165 | modifier = Modifier.fillMaxSize(),
166 | verticalArrangement = Arrangement.Center,
167 | horizontalAlignment = Alignment.CenterHorizontally
168 | ) {
169 | Text(
170 | text ="Screen C",
171 | style = MaterialTheme.typography.headlineSmall
172 | )
173 | Button(
174 | onClick = { navigator.popToRootX()},
175 | content = { Text("Go to Screen A - pop to root") }
176 | )
177 |
178 | Button(
179 | onClick = { navigator.popX() },
180 | content = { Text("pop") }
181 | )
182 |
183 | Button(
184 | onClick = { bottomSheetNavigator.showX(SampleBottomSheet()) },
185 | content = { Text("show bottom sheet") }
186 | )
187 | }
188 | }
189 | }
190 |
191 | class SampleBottomSheet : Screen {
192 | @Composable
193 | override fun Content() {
194 |
195 | val bottomSheetNavigator = LocalBottomSheetNavigator.current
196 | Column(
197 | modifier = Modifier.fillMaxWidth(),
198 | verticalArrangement = Arrangement.Center,
199 | horizontalAlignment = Alignment.CenterHorizontally
200 | ) {
201 | Text(
202 | text = "Bottom Sheet",
203 | style = MaterialTheme.typography.headlineSmall
204 | )
205 | Button(
206 | onClick = { bottomSheetNavigator.hideX() },
207 | content = { Text("Close") }
208 | )
209 | }
210 | }
211 | }
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/com/kashif/sample/theme/Color.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample.theme
2 |
3 | import androidx.compose.ui.graphics.Color
4 |
5 | //generated by https://m3.material.io/theme-builder#/custom
6 | //Color palette was taken here: https://colorhunt.co/palettes/popular
7 |
8 | internal val md_theme_light_primary = Color(0xFF00687A)
9 | internal val md_theme_light_onPrimary = Color(0xFFFFFFFF)
10 | internal val md_theme_light_primaryContainer = Color(0xFFABEDFF)
11 | internal val md_theme_light_onPrimaryContainer = Color(0xFF001F26)
12 | internal val md_theme_light_secondary = Color(0xFF00696E)
13 | internal val md_theme_light_onSecondary = Color(0xFFFFFFFF)
14 | internal val md_theme_light_secondaryContainer = Color(0xFF6FF6FE)
15 | internal val md_theme_light_onSecondaryContainer = Color(0xFF002022)
16 | internal val md_theme_light_tertiary = Color(0xFF904D00)
17 | internal val md_theme_light_onTertiary = Color(0xFFFFFFFF)
18 | internal val md_theme_light_tertiaryContainer = Color(0xFFFFDCC2)
19 | internal val md_theme_light_onTertiaryContainer = Color(0xFF2E1500)
20 | internal val md_theme_light_error = Color(0xFFBA1A1A)
21 | internal val md_theme_light_errorContainer = Color(0xFFFFDAD6)
22 | internal val md_theme_light_onError = Color(0xFFFFFFFF)
23 | internal val md_theme_light_onErrorContainer = Color(0xFF410002)
24 | internal val md_theme_light_background = Color(0xFFFFFBFF)
25 | internal val md_theme_light_onBackground = Color(0xFF221B00)
26 | internal val md_theme_light_surface = Color(0xFFFFFBFF)
27 | internal val md_theme_light_onSurface = Color(0xFF221B00)
28 | internal val md_theme_light_surfaceVariant = Color(0xFFDBE4E7)
29 | internal val md_theme_light_onSurfaceVariant = Color(0xFF3F484B)
30 | internal val md_theme_light_outline = Color(0xFF70797B)
31 | internal val md_theme_light_inverseOnSurface = Color(0xFFFFF0C0)
32 | internal val md_theme_light_inverseSurface = Color(0xFF3A3000)
33 | internal val md_theme_light_inversePrimary = Color(0xFF55D6F4)
34 | internal val md_theme_light_shadow = Color(0xFF000000)
35 | internal val md_theme_light_surfaceTint = Color(0xFF00687A)
36 | internal val md_theme_light_outlineVariant = Color(0xFFBFC8CB)
37 | internal val md_theme_light_scrim = Color(0xFF000000)
38 |
39 | internal val md_theme_dark_primary = Color(0xFF55D6F4)
40 | internal val md_theme_dark_onPrimary = Color(0xFF003640)
41 | internal val md_theme_dark_primaryContainer = Color(0xFF004E5C)
42 | internal val md_theme_dark_onPrimaryContainer = Color(0xFFABEDFF)
43 | internal val md_theme_dark_secondary = Color(0xFF4CD9E2)
44 | internal val md_theme_dark_onSecondary = Color(0xFF00373A)
45 | internal val md_theme_dark_secondaryContainer = Color(0xFF004F53)
46 | internal val md_theme_dark_onSecondaryContainer = Color(0xFF6FF6FE)
47 | internal val md_theme_dark_tertiary = Color(0xFFFFB77C)
48 | internal val md_theme_dark_onTertiary = Color(0xFF4D2700)
49 | internal val md_theme_dark_tertiaryContainer = Color(0xFF6D3900)
50 | internal val md_theme_dark_onTertiaryContainer = Color(0xFFFFDCC2)
51 | internal val md_theme_dark_error = Color(0xFFFFB4AB)
52 | internal val md_theme_dark_errorContainer = Color(0xFF93000A)
53 | internal val md_theme_dark_onError = Color(0xFF690005)
54 | internal val md_theme_dark_onErrorContainer = Color(0xFFFFDAD6)
55 | internal val md_theme_dark_background = Color(0xFF221B00)
56 | internal val md_theme_dark_onBackground = Color(0xFFFFE264)
57 | internal val md_theme_dark_surface = Color(0xFF221B00)
58 | internal val md_theme_dark_onSurface = Color(0xFFFFE264)
59 | internal val md_theme_dark_surfaceVariant = Color(0xFF3F484B)
60 | internal val md_theme_dark_onSurfaceVariant = Color(0xFFBFC8CB)
61 | internal val md_theme_dark_outline = Color(0xFF899295)
62 | internal val md_theme_dark_inverseOnSurface = Color(0xFF221B00)
63 | internal val md_theme_dark_inverseSurface = Color(0xFFFFE264)
64 | internal val md_theme_dark_inversePrimary = Color(0xFF00687A)
65 | internal val md_theme_dark_shadow = Color(0xFF000000)
66 | internal val md_theme_dark_surfaceTint = Color(0xFF55D6F4)
67 | internal val md_theme_dark_outlineVariant = Color(0xFF3F484B)
68 | internal val md_theme_dark_scrim = Color(0xFF000000)
69 |
70 |
71 | internal val seed = Color(0xFF2C3639)
72 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/com/kashif/sample/theme/Theme.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample.theme
2 |
3 | import androidx.compose.foundation.isSystemInDarkTheme
4 | import androidx.compose.material3.MaterialTheme
5 | import androidx.compose.material3.Surface
6 | import androidx.compose.material3.darkColorScheme
7 | import androidx.compose.material3.lightColorScheme
8 | import androidx.compose.runtime.*
9 |
10 | private val LightColorScheme = lightColorScheme(
11 | primary = md_theme_light_primary,
12 | onPrimary = md_theme_light_onPrimary,
13 | primaryContainer = md_theme_light_primaryContainer,
14 | onPrimaryContainer = md_theme_light_onPrimaryContainer,
15 | secondary = md_theme_light_secondary,
16 | onSecondary = md_theme_light_onSecondary,
17 | secondaryContainer = md_theme_light_secondaryContainer,
18 | onSecondaryContainer = md_theme_light_onSecondaryContainer,
19 | tertiary = md_theme_light_tertiary,
20 | onTertiary = md_theme_light_onTertiary,
21 | tertiaryContainer = md_theme_light_tertiaryContainer,
22 | onTertiaryContainer = md_theme_light_onTertiaryContainer,
23 | error = md_theme_light_error,
24 | errorContainer = md_theme_light_errorContainer,
25 | onError = md_theme_light_onError,
26 | onErrorContainer = md_theme_light_onErrorContainer,
27 | background = md_theme_light_background,
28 | onBackground = md_theme_light_onBackground,
29 | surface = md_theme_light_surface,
30 | onSurface = md_theme_light_onSurface,
31 | surfaceVariant = md_theme_light_surfaceVariant,
32 | onSurfaceVariant = md_theme_light_onSurfaceVariant,
33 | outline = md_theme_light_outline,
34 | inverseOnSurface = md_theme_light_inverseOnSurface,
35 | inverseSurface = md_theme_light_inverseSurface,
36 | inversePrimary = md_theme_light_inversePrimary,
37 | surfaceTint = md_theme_light_surfaceTint,
38 | outlineVariant = md_theme_light_outlineVariant,
39 | scrim = md_theme_light_scrim,
40 | )
41 |
42 | private val DarkColorScheme = darkColorScheme(
43 | primary = md_theme_dark_primary,
44 | onPrimary = md_theme_dark_onPrimary,
45 | primaryContainer = md_theme_dark_primaryContainer,
46 | onPrimaryContainer = md_theme_dark_onPrimaryContainer,
47 | secondary = md_theme_dark_secondary,
48 | onSecondary = md_theme_dark_onSecondary,
49 | secondaryContainer = md_theme_dark_secondaryContainer,
50 | onSecondaryContainer = md_theme_dark_onSecondaryContainer,
51 | tertiary = md_theme_dark_tertiary,
52 | onTertiary = md_theme_dark_onTertiary,
53 | tertiaryContainer = md_theme_dark_tertiaryContainer,
54 | onTertiaryContainer = md_theme_dark_onTertiaryContainer,
55 | error = md_theme_dark_error,
56 | errorContainer = md_theme_dark_errorContainer,
57 | onError = md_theme_dark_onError,
58 | onErrorContainer = md_theme_dark_onErrorContainer,
59 | background = md_theme_dark_background,
60 | onBackground = md_theme_dark_onBackground,
61 | surface = md_theme_dark_surface,
62 | onSurface = md_theme_dark_onSurface,
63 | surfaceVariant = md_theme_dark_surfaceVariant,
64 | onSurfaceVariant = md_theme_dark_onSurfaceVariant,
65 | outline = md_theme_dark_outline,
66 | inverseOnSurface = md_theme_dark_inverseOnSurface,
67 | inverseSurface = md_theme_dark_inverseSurface,
68 | inversePrimary = md_theme_dark_inversePrimary,
69 | surfaceTint = md_theme_dark_surfaceTint,
70 | outlineVariant = md_theme_dark_outlineVariant,
71 | scrim = md_theme_dark_scrim,
72 | )
73 |
74 | internal val LocalThemeIsDark = compositionLocalOf { mutableStateOf(true) }
75 |
76 | @Composable
77 | internal fun AppTheme(
78 | content: @Composable () -> Unit
79 | ) {
80 | val systemIsDark = isSystemInDarkTheme()
81 | val isDarkState = remember { mutableStateOf(systemIsDark) }
82 | CompositionLocalProvider(
83 | LocalThemeIsDark provides isDarkState
84 | ) {
85 | val isDark by isDarkState
86 | SystemAppearance(!isDark)
87 | MaterialTheme(
88 | colorScheme = if (isDark) DarkColorScheme else LightColorScheme,
89 | content = { Surface(content = content) }
90 | )
91 | }
92 | }
93 |
94 | @Composable
95 | internal expect fun SystemAppearance(isDark: Boolean)
96 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/com/kashif/sample/voyager/VoyagerExtension.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample.voyager
2 |
3 | import cafe.adriel.voyager.core.screen.Screen
4 | import cafe.adriel.voyager.navigator.Navigator
5 | import cafe.adriel.voyager.navigator.bottomSheet.BottomSheetNavigator
6 |
7 | expect fun Navigator.popX()
8 |
9 | expect fun Navigator.pushX(screen: Screen)
10 |
11 | expect fun Navigator.popToRootX()
12 |
13 | expect fun BottomSheetNavigator.hideX()
14 |
15 | expect fun BottomSheetNavigator.showX(screen: Screen)
--------------------------------------------------------------------------------
/composeApp/src/commonTest/kotlin/com/kashif/sample/ComposeTest.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample
2 |
3 | import androidx.compose.foundation.layout.Column
4 | import androidx.compose.material3.Button
5 | import androidx.compose.material3.Text
6 | import androidx.compose.runtime.getValue
7 | import androidx.compose.runtime.mutableStateOf
8 | import androidx.compose.runtime.remember
9 | import androidx.compose.runtime.setValue
10 | import androidx.compose.ui.Modifier
11 | import androidx.compose.ui.platform.testTag
12 | import androidx.compose.ui.test.ExperimentalTestApi
13 | import androidx.compose.ui.test.assertTextEquals
14 | import androidx.compose.ui.test.onNodeWithTag
15 | import androidx.compose.ui.test.performClick
16 | import androidx.compose.ui.test.runComposeUiTest
17 | import kotlin.test.Test
18 |
19 | @OptIn(ExperimentalTestApi::class)
20 | class ComposeTest {
21 |
22 | @Test
23 | fun simpleCheck() = runComposeUiTest {
24 | setContent {
25 | var txt by remember { mutableStateOf("Go") }
26 | Column {
27 | Text(
28 | text = txt,
29 | modifier = Modifier.testTag("t_text")
30 | )
31 | Button(
32 | onClick = { txt += "." },
33 | modifier = Modifier.testTag("t_button")
34 | ) {
35 | Text("click me")
36 | }
37 | }
38 | }
39 |
40 | onNodeWithTag("t_button").apply {
41 | repeat(3) { performClick() }
42 | }
43 | onNodeWithTag("t_text").assertTextEquals("Go...")
44 | }
45 | }
--------------------------------------------------------------------------------
/composeApp/src/iosMain/kotlin/com/kashif/sample/theme/Theme.ios.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample.theme
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.runtime.LaunchedEffect
5 | import platform.UIKit.UIApplication
6 | import platform.UIKit.UIStatusBarStyleDarkContent
7 | import platform.UIKit.UIStatusBarStyleLightContent
8 | import platform.UIKit.setStatusBarStyle
9 |
10 | @Composable
11 | internal actual fun SystemAppearance(isDark: Boolean) {
12 | LaunchedEffect(isDark) {
13 | UIApplication.sharedApplication.setStatusBarStyle(
14 | if (isDark) UIStatusBarStyleDarkContent else UIStatusBarStyleLightContent
15 | )
16 | }
17 | }
--------------------------------------------------------------------------------
/composeApp/src/iosMain/kotlin/com/kashif/sample/voyager/UIViewControllerWrapper.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample.voyager
2 |
3 | import kotlinx.cinterop.BetaInteropApi
4 | import kotlinx.cinterop.ExperimentalForeignApi
5 | import kotlinx.cinterop.ObjCAction
6 | import platform.Foundation.NSLog
7 | import platform.Foundation.NSSelectorFromString
8 | import platform.UIKit.UIGestureRecognizer
9 | import platform.UIKit.UIGestureRecognizerDelegateProtocol
10 | import platform.UIKit.UISwipeGestureRecognizer
11 | import platform.UIKit.UISwipeGestureRecognizerDirectionLeft
12 | import platform.UIKit.UISwipeGestureRecognizerDirectionRight
13 | import platform.UIKit.UIViewController
14 | import platform.UIKit.addChildViewController
15 | import platform.UIKit.didMoveToParentViewController
16 | import platform.UIKit.navigationController
17 | import platform.UIKit.willMoveToParentViewController
18 |
19 | /**
20 | * A custom `UIViewController` that wraps another `UIViewController` and adds gesture recognizer functionality.
21 | * Implements the `UIGestureRecognizerDelegateProtocol` to handle swipe gestures.
22 | *
23 | * @property controller The `UIViewController` instance that is being wrapped.
24 | */
25 | class UIViewControllerWrapper(
26 | private val controller: UIViewController,
27 | ) : UIViewController(null, null), UIGestureRecognizerDelegateProtocol {
28 |
29 | /**
30 | * Called when the view controller's view is loaded into memory.
31 | * Sets up the view hierarchy by adding the wrapped controller's view as a subview
32 | * and managing the parent-child relationship between the view controllers.
33 | */
34 | @OptIn(ExperimentalForeignApi::class)
35 | override fun loadView() {
36 | super.loadView()
37 | controller.willMoveToParentViewController(this)
38 | controller.view.setFrame(view.frame)
39 | view.addSubview(controller.view)
40 | addChildViewController(controller)
41 | controller.didMoveToParentViewController(this)
42 | }
43 |
44 | /**
45 | * Called after the view has been loaded.
46 | * Sets the delegate for the interactive pop gesture recognizer and adds swipe gesture recognizers
47 | * for left and right swipe directions.
48 | */
49 | @OptIn(ExperimentalForeignApi::class)
50 | override fun viewDidLoad() {
51 | super.viewDidLoad()
52 | controller.navigationController?.interactivePopGestureRecognizer?.delegate = this
53 |
54 | val directions =
55 | listOf(UISwipeGestureRecognizerDirectionRight, UISwipeGestureRecognizerDirectionLeft)
56 | for (direction in directions) {
57 | val gesture = UISwipeGestureRecognizer(
58 | target = this,
59 | action = NSSelectorFromString("handleSwipe:")
60 | )
61 | gesture.direction = direction
62 | gesture.delegate = this
63 | this.view.addGestureRecognizer(gesture)
64 | }
65 | }
66 |
67 | /**
68 | * Handles the swipe gestures detected by the gesture recognizers.
69 | * Logs the direction of the swipe.
70 | *
71 | * @param sender The `UISwipeGestureRecognizer` that detected the swipe.
72 | */
73 | @OptIn(BetaInteropApi::class)
74 | @ObjCAction
75 | fun handleSwipe(sender: UISwipeGestureRecognizer) {
76 | NSLog("Swipe detected: ${sender.direction}")
77 | }
78 |
79 | /**
80 | * Determines whether the gesture recognizer should begin interpreting touches.
81 | * Always returns `true`.
82 | *
83 | * @param gestureRecognizer The `UIGestureRecognizer` that is asking whether it should begin.
84 | * @return `true` to allow the gesture recognizer to begin.
85 | */
86 | override fun gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer): Boolean {
87 | return true
88 | }
89 |
90 | /**
91 | * Determines whether the gesture recognizer should be required to fail by another gesture recognizer.
92 | * Always returns `true`.
93 | *
94 | * @param gestureRecognizer The `UIGestureRecognizer` that is asking whether it should be required to fail.
95 | * @param shouldBeRequiredToFailByGestureRecognizer The `UIGestureRecognizer` that is requiring the failure.
96 | * @return `true` to require the gesture recognizer to fail.
97 | */
98 | override fun gestureRecognizer(
99 | gestureRecognizer: UIGestureRecognizer,
100 | shouldBeRequiredToFailByGestureRecognizer: UIGestureRecognizer
101 | ): Boolean {
102 | return true
103 | }
104 | }
--------------------------------------------------------------------------------
/composeApp/src/iosMain/kotlin/com/kashif/sample/voyager/ViewcontrollerExtensions.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample.voyager
2 |
3 | import androidx.compose.foundation.layout.Box
4 | import androidx.compose.foundation.layout.WindowInsets
5 | import androidx.compose.foundation.layout.asPaddingValues
6 | import androidx.compose.foundation.layout.fillMaxSize
7 | import androidx.compose.foundation.layout.imePadding
8 | import androidx.compose.foundation.layout.padding
9 | import androidx.compose.foundation.layout.safeDrawing
10 | import androidx.compose.material.ExperimentalMaterialApi
11 | import androidx.compose.runtime.ExperimentalComposeApi
12 | import androidx.compose.ui.Modifier
13 | import androidx.compose.ui.uikit.OnFocusBehavior
14 | import androidx.compose.ui.window.ComposeUIViewController
15 | import cafe.adriel.voyager.core.screen.Screen
16 | import cafe.adriel.voyager.navigator.Navigator
17 | import cafe.adriel.voyager.navigator.bottomSheet.BottomSheetNavigator
18 | import com.kashif.sample.theme.AppTheme
19 | import platform.Foundation.NSLog
20 | import platform.UIKit.UIApplication
21 | import platform.UIKit.UINavigationController
22 | import platform.UIKit.UITabBarController
23 | import platform.UIKit.UIViewController
24 | import platform.UIKit.childViewControllers
25 |
26 | /**
27 | * Retrieves the top `UIViewController` from the view hierarchy.
28 | *
29 | * @param base The base `UIViewController` to start the search from. Defaults to the root view controller of the key window.
30 | * @return The top `UIViewController`, or null if none is found.
31 | */
32 | fun getTopViewController(base: UIViewController? = UIApplication.sharedApplication().keyWindow?.rootViewController): UIViewController? {
33 | when {
34 | base is UINavigationController -> {
35 | return getTopViewController(base = base.visibleViewController)
36 | }
37 | base is UITabBarController -> {
38 | return getTopViewController(base = base.selectedViewController)
39 | }
40 | base?.presentedViewController != null -> {
41 | return getTopViewController(base = base.presentedViewController)
42 | }
43 | base.toString().contains("HostingController") -> return getTopViewController(
44 | base = base?.childViewControllers()?.first() as UIViewController
45 | )
46 | else -> {
47 | return base
48 | }
49 | }
50 | }
51 |
52 | /**
53 | * Logs the hierarchy of the top `UIViewController` for debugging purposes.
54 | *
55 | * @param base The base `UIViewController` to start the search from. Defaults to the root view controller of the key window.
56 | */
57 | fun debugTopViewController(base: UIViewController? = UIApplication.sharedApplication().keyWindow?.rootViewController) {
58 | if (base is UINavigationController) {
59 | NSLog("TopViewController: UINavigationController with visible view controller: ${base.visibleViewController}")
60 | debugTopViewController(base = base.visibleViewController)
61 | } else if (base is UITabBarController) {
62 | NSLog("TopViewController: UITabBarController with selected view controller: ${base.selectedViewController}")
63 | debugTopViewController(base = base.selectedViewController)
64 | } else if (base?.presentedViewController != null) {
65 | NSLog("TopViewController: Presented view controller: ${base.presentedViewController}")
66 | debugTopViewController(base = base.presentedViewController)
67 | } else {
68 | NSLog("TopViewController: ${base}")
69 | }
70 | }
71 |
72 | /**
73 | * Creates a `UIViewController` that hosts a Compose UI.
74 | *
75 | * @param modifier The `Modifier` to be applied to the Compose UI.
76 | * @param screen The `Screen` to be displayed in the Compose UI.
77 | * @param isOpaque Whether the view controller's view is opaque.
78 | * @return A `UIViewController` that hosts the Compose UI.
79 | */
80 | @OptIn(ExperimentalComposeApi::class, ExperimentalMaterialApi::class)
81 | fun extendedComposeViewController(
82 | modifier: Modifier = Modifier,
83 | screen: Screen,
84 | isOpaque: Boolean = true,
85 | ): UIViewController {
86 | val uiViewController = ComposeUIViewController(configure = {
87 | onFocusBehavior = OnFocusBehavior.DoNothing
88 | opaque = isOpaque
89 | }) {
90 | AppTheme {
91 | Box(
92 | modifier = modifier.imePadding()
93 | .padding(top = WindowInsets.safeDrawing.asPaddingValues().calculateTopPadding())
94 | ) {
95 | BottomSheetNavigator {
96 | Navigator(screen = screen)
97 | }
98 | }
99 | }
100 | }
101 |
102 | return UIViewControllerWrapper(uiViewController)
103 | }
--------------------------------------------------------------------------------
/composeApp/src/iosMain/kotlin/com/kashif/sample/voyager/VoyagerExtension.ios.kt:
--------------------------------------------------------------------------------
1 | package com.kashif.sample.voyager
2 |
3 | import cafe.adriel.voyager.core.screen.Screen
4 | import cafe.adriel.voyager.navigator.Navigator
5 | import cafe.adriel.voyager.navigator.bottomSheet.BottomSheetNavigator
6 | import platform.Foundation.NSLog
7 | import platform.UIKit.UINavigationController
8 | import platform.UIKit.UINavigationControllerDelegateProtocol
9 | import platform.UIKit.hidesBottomBarWhenPushed
10 | import platform.UIKit.navigationController
11 |
12 | /**
13 | * Pushes a new screen onto the navigation stack.
14 | *
15 | * @param screen The screen to be pushed.
16 | */
17 | actual fun Navigator.pushX(screen: Screen) {
18 | val viewController = extendedComposeViewController(screen = screen)
19 | viewController.hidesBottomBarWhenPushed = true
20 |
21 | val navigationController = getNavigationController()
22 | navigationController?.let { navController ->
23 | navController.interactivePopGestureRecognizer?.enabled = true
24 | navController.delegate = viewController as? UINavigationControllerDelegateProtocol
25 | navController.pushViewController(viewController, animated = true)
26 | } ?: run {
27 | NSLog("NavigationController is null")
28 | }
29 | }
30 |
31 | /**
32 | * Pops the top screen from the navigation stack.
33 | */
34 | actual fun Navigator.popX() {
35 | val navigationController = getNavigationController()
36 | navigationController?.let { navController ->
37 | if (navController.viewControllers.size > 1) {
38 | navController.popViewControllerAnimated(true)
39 | } else {
40 | NSLog("Cannot pop. Only one view controller in the stack.")
41 | }
42 | } ?: run {
43 | NSLog("NavigationController is null")
44 | }
45 | }
46 |
47 | /**
48 | * Pops all the screens on the navigation stack until the root screen is at the top.
49 | */
50 | actual fun Navigator.popToRootX() {
51 | val navigationController = getNavigationController()
52 | navigationController?.popToRootViewControllerAnimated(true) ?: run {
53 | NSLog("NavigationController is null")
54 | }
55 | }
56 |
57 | /**
58 | * Retrieves the top `UINavigationController` from the view hierarchy.
59 | *
60 | * @return The top `UINavigationController`, or null if none is found.
61 | */
62 | fun getNavigationController(): UINavigationController? {
63 | val topVc = getTopViewController()
64 | return topVc?.let { topViewController ->
65 | topViewController as? UINavigationController ?: topViewController.navigationController
66 | }
67 | }
68 |
69 | actual fun BottomSheetNavigator.hideX() {
70 | val topVc = getTopViewController()
71 | topVc?.dismissViewControllerAnimated(true, null) ?: run {
72 | NSLog("TopViewController is null")
73 | }
74 | }
75 |
76 | actual fun BottomSheetNavigator.showX(screen: Screen) {
77 | val viewController = extendedComposeViewController(screen = screen)
78 | val topVc = getTopViewController()
79 | topVc?.presentViewController(viewController, animated = true, completion = null) ?: run {
80 | NSLog("TopViewController is null")
81 | }
82 | }
--------------------------------------------------------------------------------
/composeApp/src/iosMain/kotlin/main.kt:
--------------------------------------------------------------------------------
1 | import androidx.compose.ui.window.ComposeUIViewController
2 | import com.kashif.sample.App
3 | import platform.UIKit.UIViewController
4 |
5 | fun MainViewController(): UIViewController = ComposeUIViewController { App() }
6 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #Gradle
2 | org.gradle.jvmargs=-Xmx4G
3 | org.gradle.caching=true
4 | org.gradle.configuration-cache=true
5 | org.gradle.daemon=true
6 | org.gradle.parallel=true
7 |
8 | #Kotlin
9 | kotlin.code.style=official
10 | kotlin.daemon.jvmargs=-Xmx4G
11 |
12 | #Android
13 | android.useAndroidX=true
14 | android.nonTransitiveRClass=true
15 |
16 | #Compose
17 | org.jetbrains.compose.experimental.jscanvas.enabled=true
18 |
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 |
3 | kotlin = "2.0.20"
4 | compose = "1.7.0-alpha03"
5 | agp = "8.5.2"
6 | androidx-activityCompose = "1.9.1"
7 | androidx-uiTest = "1.6.8"
8 | voyager = "1.1.0-beta02"
9 | napier = "2.7.1"
10 |
11 | [libraries]
12 |
13 | androidx-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
14 | androidx-uitest-testManifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "androidx-uiTest" }
15 | androidx-uitest-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "androidx-uiTest" }
16 | voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" }
17 | napier = { module = "io.github.aakira:napier", version.ref = "napier" }
18 |
19 | [plugins]
20 |
21 | multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
22 | compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
23 | compose = { id = "org.jetbrains.compose", version.ref = "compose" }
24 | android-application = { id = "com.android.application", version.ref = "agp" }
25 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kashif-E/Native-Ios-Navigation-Compose-Multiplatform/460e7b4317a28d08ea35db1dfb0d14e8da40acca/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # Determine the Java command to use to start the JVM.
119 | if [ -n "$JAVA_HOME" ] ; then
120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 | # IBM's JDK on AIX uses strange locations for the executables
122 | JAVACMD=$JAVA_HOME/jre/sh/java
123 | else
124 | JAVACMD=$JAVA_HOME/bin/java
125 | fi
126 | if [ ! -x "$JAVACMD" ] ; then
127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 |
129 | Please set the JAVA_HOME variable in your environment to match the
130 | location of your Java installation."
131 | fi
132 | else
133 | JAVACMD=java
134 | if ! command -v java >/dev/null 2>&1
135 | then
136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 | fi
142 |
143 | # Increase the maximum file descriptors if we can.
144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 | case $MAX_FD in #(
146 | max*)
147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 | # shellcheck disable=SC2039,SC3045
149 | MAX_FD=$( ulimit -H -n ) ||
150 | warn "Could not query maximum file descriptor limit"
151 | esac
152 | case $MAX_FD in #(
153 | '' | soft) :;; #(
154 | *)
155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 | # shellcheck disable=SC2039,SC3045
157 | ulimit -n "$MAX_FD" ||
158 | warn "Could not set maximum file descriptor limit to $MAX_FD"
159 | esac
160 | fi
161 |
162 | # Collect all arguments for the java command, stacking in reverse order:
163 | # * args from the command line
164 | # * the main class name
165 | # * -classpath
166 | # * -D...appname settings
167 | # * --module-path (only if needed)
168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169 |
170 | # For Cygwin or MSYS, switch paths to Windows format before running java
171 | if "$cygwin" || "$msys" ; then
172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174 |
175 | JAVACMD=$( cygpath --unix "$JAVACMD" )
176 |
177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 | for arg do
179 | if
180 | case $arg in #(
181 | -*) false ;; # don't mess with options #(
182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 | [ -e "$t" ] ;; #(
184 | *) false ;;
185 | esac
186 | then
187 | arg=$( cygpath --path --ignore --mixed "$arg" )
188 | fi
189 | # Roll the args list around exactly as many times as the number of
190 | # args, so each arg winds up back in the position where it started, but
191 | # possibly modified.
192 | #
193 | # NB: a `for` loop captures its iteration list before it begins, so
194 | # changing the positional parameters here affects neither the number of
195 | # iterations, nor the values presented in `arg`.
196 | shift # remove old arg
197 | set -- "$@" "$arg" # push replacement arg
198 | done
199 | fi
200 |
201 |
202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204 |
205 | # Collect all arguments for the java command:
206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 | # and any embedded shellness will be escaped.
208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 | # treated as '${Hostname}' itself on the command line.
210 |
211 | set -- \
212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 | -classpath "$CLASSPATH" \
214 | org.gradle.wrapper.GradleWrapperMain \
215 | "$@"
216 |
217 | # Stop when "xargs" is not available.
218 | if ! command -v xargs >/dev/null 2>&1
219 | then
220 | die "xargs is not available"
221 | fi
222 |
223 | # Use "xargs" to parse quoted args.
224 | #
225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226 | #
227 | # In Bash we could simply go:
228 | #
229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230 | # set -- "${ARGS[@]}" "$@"
231 | #
232 | # but POSIX shell has neither arrays nor command substitution, so instead we
233 | # post-process each arg (as a line of input to sed) to backslash-escape any
234 | # character that might be a shell metacharacter, then use eval to reverse
235 | # that process (while maintaining the separation between arguments), and wrap
236 | # the whole thing up as a single "set" statement.
237 | #
238 | # This will of course break if any of these variables contains a newline or
239 | # an unmatched quote.
240 | #
241 |
242 | eval "set -- $(
243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 | xargs -n1 |
245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 | tr '\n' ' '
247 | )" '"$@"'
248 |
249 | exec "$JAVACMD" "$@"
250 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo. 1>&2
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48 | echo. 1>&2
49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50 | echo location of your Java installation. 1>&2
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo. 1>&2
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62 | echo. 1>&2
63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64 | echo location of your Java installation. 1>&2
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/iosApp/iosApp.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 56;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | A93A953B29CC810C00F8E227 /* iosApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93A953A29CC810C00F8E227 /* iosApp.swift */; };
11 | A93A953F29CC810D00F8E227 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A93A953E29CC810D00F8E227 /* Assets.xcassets */; };
12 | A93A954229CC810D00F8E227 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A93A954129CC810D00F8E227 /* Preview Assets.xcassets */; };
13 | /* End PBXBuildFile section */
14 |
15 | /* Begin PBXFileReference section */
16 | A93A953729CC810C00F8E227 /* IosNavigationINComposeMultiplatform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IosNavigationINComposeMultiplatform.app; sourceTree = BUILT_PRODUCTS_DIR; };
17 | A93A953A29CC810C00F8E227 /* iosApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosApp.swift; sourceTree = ""; };
18 | A93A953E29CC810D00F8E227 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
19 | A93A954129CC810D00F8E227 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
20 | /* End PBXFileReference section */
21 |
22 | /* Begin PBXFrameworksBuildPhase section */
23 | A93A953429CC810C00F8E227 /* Frameworks */ = {
24 | isa = PBXFrameworksBuildPhase;
25 | buildActionMask = 2147483647;
26 | files = (
27 | );
28 | runOnlyForDeploymentPostprocessing = 0;
29 | };
30 | /* End PBXFrameworksBuildPhase section */
31 |
32 | /* Begin PBXGroup section */
33 | A93A952E29CC810C00F8E227 = {
34 | isa = PBXGroup;
35 | children = (
36 | A93A953929CC810C00F8E227 /* iosApp */,
37 | A93A953829CC810C00F8E227 /* Products */,
38 | C4127409AE3703430489E7BC /* Frameworks */,
39 | );
40 | sourceTree = "";
41 | };
42 | A93A953829CC810C00F8E227 /* Products */ = {
43 | isa = PBXGroup;
44 | children = (
45 | A93A953729CC810C00F8E227 /* IosNavigationINComposeMultiplatform.app */,
46 | );
47 | name = Products;
48 | sourceTree = "";
49 | };
50 | A93A953929CC810C00F8E227 /* iosApp */ = {
51 | isa = PBXGroup;
52 | children = (
53 | A93A953A29CC810C00F8E227 /* iosApp.swift */,
54 | A93A953E29CC810D00F8E227 /* Assets.xcassets */,
55 | A93A954029CC810D00F8E227 /* Preview Content */,
56 | );
57 | path = iosApp;
58 | sourceTree = "";
59 | };
60 | A93A954029CC810D00F8E227 /* Preview Content */ = {
61 | isa = PBXGroup;
62 | children = (
63 | A93A954129CC810D00F8E227 /* Preview Assets.xcassets */,
64 | );
65 | path = "Preview Content";
66 | sourceTree = "";
67 | };
68 | C4127409AE3703430489E7BC /* Frameworks */ = {
69 | isa = PBXGroup;
70 | children = (
71 | );
72 | name = Frameworks;
73 | sourceTree = "";
74 | };
75 | /* End PBXGroup section */
76 |
77 | /* Begin PBXNativeTarget section */
78 | A93A953629CC810C00F8E227 /* iosApp */ = {
79 | isa = PBXNativeTarget;
80 | buildConfigurationList = A93A954529CC810D00F8E227 /* Build configuration list for PBXNativeTarget "iosApp" */;
81 | buildPhases = (
82 | A9D80A052AAB5CDE006C8738 /* ShellScript */,
83 | A93A953329CC810C00F8E227 /* Sources */,
84 | A93A953429CC810C00F8E227 /* Frameworks */,
85 | A93A953529CC810C00F8E227 /* Resources */,
86 | );
87 | buildRules = (
88 | );
89 | dependencies = (
90 | );
91 | name = iosApp;
92 | productName = iosApp;
93 | productReference = A93A953729CC810C00F8E227 /* IosNavigationINComposeMultiplatform.app */;
94 | productType = "com.apple.product-type.application";
95 | };
96 | /* End PBXNativeTarget section */
97 |
98 | /* Begin PBXProject section */
99 | A93A952F29CC810C00F8E227 /* Project object */ = {
100 | isa = PBXProject;
101 | attributes = {
102 | LastSwiftUpdateCheck = 1420;
103 | LastUpgradeCheck = 1420;
104 | TargetAttributes = {
105 | A93A953629CC810C00F8E227 = {
106 | CreatedOnToolsVersion = 14.2;
107 | };
108 | };
109 | };
110 | buildConfigurationList = A93A953229CC810C00F8E227 /* Build configuration list for PBXProject "iosApp" */;
111 | compatibilityVersion = "Xcode 14.0";
112 | developmentRegion = en;
113 | hasScannedForEncodings = 0;
114 | knownRegions = (
115 | en,
116 | Base,
117 | );
118 | mainGroup = A93A952E29CC810C00F8E227;
119 | productRefGroup = A93A953829CC810C00F8E227 /* Products */;
120 | projectDirPath = "";
121 | projectRoot = "";
122 | targets = (
123 | A93A953629CC810C00F8E227 /* iosApp */,
124 | );
125 | };
126 | /* End PBXProject section */
127 |
128 | /* Begin PBXResourcesBuildPhase section */
129 | A93A953529CC810C00F8E227 /* Resources */ = {
130 | isa = PBXResourcesBuildPhase;
131 | buildActionMask = 2147483647;
132 | files = (
133 | A93A954229CC810D00F8E227 /* Preview Assets.xcassets in Resources */,
134 | A93A953F29CC810D00F8E227 /* Assets.xcassets in Resources */,
135 | );
136 | runOnlyForDeploymentPostprocessing = 0;
137 | };
138 | /* End PBXResourcesBuildPhase section */
139 |
140 | /* Begin PBXShellScriptBuildPhase section */
141 | A9D80A052AAB5CDE006C8738 /* ShellScript */ = {
142 | isa = PBXShellScriptBuildPhase;
143 | buildActionMask = 2147483647;
144 | files = (
145 | );
146 | inputFileListPaths = (
147 | );
148 | inputPaths = (
149 | );
150 | outputFileListPaths = (
151 | );
152 | outputPaths = (
153 | );
154 | runOnlyForDeploymentPostprocessing = 0;
155 | shellPath = /bin/sh;
156 | shellScript = "cd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n";
157 | };
158 | /* End PBXShellScriptBuildPhase section */
159 |
160 | /* Begin PBXSourcesBuildPhase section */
161 | A93A953329CC810C00F8E227 /* Sources */ = {
162 | isa = PBXSourcesBuildPhase;
163 | buildActionMask = 2147483647;
164 | files = (
165 | A93A953B29CC810C00F8E227 /* iosApp.swift in Sources */,
166 | );
167 | runOnlyForDeploymentPostprocessing = 0;
168 | };
169 | /* End PBXSourcesBuildPhase section */
170 |
171 | /* Begin XCBuildConfiguration section */
172 | A93A954329CC810D00F8E227 /* Debug */ = {
173 | isa = XCBuildConfiguration;
174 | buildSettings = {
175 | ALWAYS_SEARCH_USER_PATHS = NO;
176 | CLANG_ANALYZER_NONNULL = YES;
177 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
178 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
179 | CLANG_ENABLE_MODULES = YES;
180 | CLANG_ENABLE_OBJC_ARC = YES;
181 | CLANG_ENABLE_OBJC_WEAK = YES;
182 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
183 | CLANG_WARN_BOOL_CONVERSION = YES;
184 | CLANG_WARN_COMMA = YES;
185 | CLANG_WARN_CONSTANT_CONVERSION = YES;
186 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
187 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
188 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
189 | CLANG_WARN_EMPTY_BODY = YES;
190 | CLANG_WARN_ENUM_CONVERSION = YES;
191 | CLANG_WARN_INFINITE_RECURSION = YES;
192 | CLANG_WARN_INT_CONVERSION = YES;
193 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
194 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
195 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
196 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
197 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
198 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
199 | CLANG_WARN_STRICT_PROTOTYPES = YES;
200 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
201 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
202 | CLANG_WARN_UNREACHABLE_CODE = YES;
203 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
204 | COPY_PHASE_STRIP = NO;
205 | DEBUG_INFORMATION_FORMAT = dwarf;
206 | ENABLE_STRICT_OBJC_MSGSEND = YES;
207 | ENABLE_TESTABILITY = YES;
208 | GCC_C_LANGUAGE_STANDARD = gnu11;
209 | GCC_DYNAMIC_NO_PIC = NO;
210 | GCC_NO_COMMON_BLOCKS = YES;
211 | GCC_OPTIMIZATION_LEVEL = 0;
212 | GCC_PREPROCESSOR_DEFINITIONS = (
213 | "DEBUG=1",
214 | "$(inherited)",
215 | );
216 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
217 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
218 | GCC_WARN_UNDECLARED_SELECTOR = YES;
219 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
220 | GCC_WARN_UNUSED_FUNCTION = YES;
221 | GCC_WARN_UNUSED_VARIABLE = YES;
222 | IPHONEOS_DEPLOYMENT_TARGET = 16.2;
223 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
224 | MTL_FAST_MATH = YES;
225 | ONLY_ACTIVE_ARCH = YES;
226 | SDKROOT = iphoneos;
227 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
228 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
229 | };
230 | name = Debug;
231 | };
232 | A93A954429CC810D00F8E227 /* Release */ = {
233 | isa = XCBuildConfiguration;
234 | buildSettings = {
235 | ALWAYS_SEARCH_USER_PATHS = NO;
236 | CLANG_ANALYZER_NONNULL = YES;
237 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
238 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
239 | CLANG_ENABLE_MODULES = YES;
240 | CLANG_ENABLE_OBJC_ARC = YES;
241 | CLANG_ENABLE_OBJC_WEAK = YES;
242 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
243 | CLANG_WARN_BOOL_CONVERSION = YES;
244 | CLANG_WARN_COMMA = YES;
245 | CLANG_WARN_CONSTANT_CONVERSION = YES;
246 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
247 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
248 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
249 | CLANG_WARN_EMPTY_BODY = YES;
250 | CLANG_WARN_ENUM_CONVERSION = YES;
251 | CLANG_WARN_INFINITE_RECURSION = YES;
252 | CLANG_WARN_INT_CONVERSION = YES;
253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
257 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
258 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
259 | CLANG_WARN_STRICT_PROTOTYPES = YES;
260 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
261 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
262 | CLANG_WARN_UNREACHABLE_CODE = YES;
263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
264 | COPY_PHASE_STRIP = NO;
265 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
266 | ENABLE_NS_ASSERTIONS = NO;
267 | ENABLE_STRICT_OBJC_MSGSEND = YES;
268 | GCC_C_LANGUAGE_STANDARD = gnu11;
269 | GCC_NO_COMMON_BLOCKS = YES;
270 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
271 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
272 | GCC_WARN_UNDECLARED_SELECTOR = YES;
273 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
274 | GCC_WARN_UNUSED_FUNCTION = YES;
275 | GCC_WARN_UNUSED_VARIABLE = YES;
276 | IPHONEOS_DEPLOYMENT_TARGET = 16.2;
277 | MTL_ENABLE_DEBUG_INFO = NO;
278 | MTL_FAST_MATH = YES;
279 | SDKROOT = iphoneos;
280 | SWIFT_COMPILATION_MODE = wholemodule;
281 | SWIFT_OPTIMIZATION_LEVEL = "-O";
282 | VALIDATE_PRODUCT = YES;
283 | };
284 | name = Release;
285 | };
286 | A93A954629CC810D00F8E227 /* Debug */ = {
287 | isa = XCBuildConfiguration;
288 | buildSettings = {
289 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
290 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
291 | CODE_SIGN_STYLE = Automatic;
292 | CURRENT_PROJECT_VERSION = 1;
293 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
294 | DEVELOPMENT_TEAM = 82SP652DFP;
295 | ENABLE_PREVIEWS = YES;
296 | GENERATE_INFOPLIST_FILE = YES;
297 | INFOPLIST_FILE = iosApp/Info.plist;
298 | INFOPLIST_KEY_UILaunchScreen_Generation = YES;
299 | IPHONEOS_DEPLOYMENT_TARGET = 16.2;
300 | LD_RUNPATH_SEARCH_PATHS = (
301 | "$(inherited)",
302 | "@executable_path/Frameworks",
303 | );
304 | MARKETING_VERSION = 1.0;
305 | PRODUCT_BUNDLE_IDENTIFIER = com.kashif.sample.iosApp;
306 | PRODUCT_NAME = IosNavigationINComposeMultiplatform;
307 | SWIFT_EMIT_LOC_STRINGS = YES;
308 | SWIFT_VERSION = 5.0;
309 | TARGETED_DEVICE_FAMILY = "1,2";
310 | };
311 | name = Debug;
312 | };
313 | A93A954729CC810D00F8E227 /* Release */ = {
314 | isa = XCBuildConfiguration;
315 | buildSettings = {
316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
317 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
318 | CODE_SIGN_STYLE = Automatic;
319 | CURRENT_PROJECT_VERSION = 1;
320 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
321 | DEVELOPMENT_TEAM = 82SP652DFP;
322 | ENABLE_PREVIEWS = YES;
323 | GENERATE_INFOPLIST_FILE = YES;
324 | INFOPLIST_FILE = iosApp/Info.plist;
325 | INFOPLIST_KEY_UILaunchScreen_Generation = YES;
326 | IPHONEOS_DEPLOYMENT_TARGET = 16.2;
327 | LD_RUNPATH_SEARCH_PATHS = (
328 | "$(inherited)",
329 | "@executable_path/Frameworks",
330 | );
331 | MARKETING_VERSION = 1.0;
332 | PRODUCT_BUNDLE_IDENTIFIER = com.kashif.sample.iosApp;
333 | PRODUCT_NAME = IosNavigationINComposeMultiplatform;
334 | SWIFT_EMIT_LOC_STRINGS = YES;
335 | SWIFT_VERSION = 5.0;
336 | TARGETED_DEVICE_FAMILY = "1,2";
337 | };
338 | name = Release;
339 | };
340 | /* End XCBuildConfiguration section */
341 |
342 | /* Begin XCConfigurationList section */
343 | A93A953229CC810C00F8E227 /* Build configuration list for PBXProject "iosApp" */ = {
344 | isa = XCConfigurationList;
345 | buildConfigurations = (
346 | A93A954329CC810D00F8E227 /* Debug */,
347 | A93A954429CC810D00F8E227 /* Release */,
348 | );
349 | defaultConfigurationIsVisible = 0;
350 | defaultConfigurationName = Release;
351 | };
352 | A93A954529CC810D00F8E227 /* Build configuration list for PBXNativeTarget "iosApp" */ = {
353 | isa = XCConfigurationList;
354 | buildConfigurations = (
355 | A93A954629CC810D00F8E227 /* Debug */,
356 | A93A954729CC810D00F8E227 /* Release */,
357 | );
358 | defaultConfigurationIsVisible = 0;
359 | defaultConfigurationName = Release;
360 | };
361 | /* End XCConfigurationList section */
362 | };
363 | rootObject = A93A952F29CC810C00F8E227 /* Project object */;
364 | }
365 |
--------------------------------------------------------------------------------
/iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "platform" : "ios",
6 | "size" : "1024x1024"
7 | }
8 | ],
9 | "info" : {
10 | "author" : "xcode",
11 | "version" : 1
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CADisableMinimumFrameDurationOnPhone
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/iosApp/iosApp/iosApp.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import ComposeApp
3 |
4 | @main
5 | class AppDelegate: UIResponder, UIApplicationDelegate {
6 | var window: UIWindow?
7 |
8 | func application(
9 | _ application: UIApplication,
10 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
11 | ) -> Bool {
12 | window = UIWindow(frame: UIScreen.main.bounds)
13 | if let window = window {
14 | let uiController = UINavigationController( rootViewController: MainKt.MainViewController())
15 | uiController.interactivePopGestureRecognizer?.isEnabled = true
16 | window.rootViewController = uiController
17 |
18 | window.makeKeyAndVisible()
19 | }
20 | return true
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | rootProject.name = "IosNavigationINComposeMultiplatform"
2 |
3 | pluginManagement {
4 | repositories {
5 | google {
6 | content {
7 | includeGroupByRegex("com\\.android.*")
8 | includeGroupByRegex("com\\.google.*")
9 | includeGroupByRegex("androidx.*")
10 | includeGroupByRegex("android.*")
11 | }
12 | }
13 | gradlePluginPortal()
14 | mavenCentral()
15 | }
16 | }
17 |
18 | dependencyResolutionManagement {
19 | repositories {
20 | google {
21 | content {
22 | includeGroupByRegex("com\\.android.*")
23 | includeGroupByRegex("com\\.google.*")
24 | includeGroupByRegex("androidx.*")
25 | includeGroupByRegex("android.*")
26 | }
27 | }
28 | mavenCentral()
29 | }
30 | }
31 | include(":composeApp")
32 |
33 |
--------------------------------------------------------------------------------