diff --git a/gradle.properties b/gradle.properties index f78bd0b..9873e3d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,26 +1,18 @@ -# Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true -# Kotlin code style for this project: "official" or "obsolete": +#Gradle +org.gradle.jvmargs=-Xmx4096M -Dkotlin.daemon.jvm.options\="-Xmx4096M" + +#Kotlin kotlin.code.style=official -# Enables namespacing of each library's R class so that its R class includes only the -# resources declared in the library itself and none from the library's dependencies, -# thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true +kotlin.native.useEmbeddableCompilerJar=true +kotlin.mpp.androidSourceSetLayoutVersion=2 + +#Android +android.useAndroidX=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false + +#Compose Multiplatform +org.jetbrains.compose.experimental.uikit.enabled=true POM_NAME=Navigation Compose Extended POM_DESCRIPTION=Navigation Compose Extended is a complementary library for AndroidX Jetpack Navigation Compose to improve creation of navigation elements diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 481d2fc..304ae58 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,17 +5,21 @@ androidGradlePlugin = "8.3.2" androidMinSdk = "24" composeBom = "2024.04.01" composeCompiler = "1.5.11" +composeMultiplatform = "1.6.10-beta01" coreKtx = "1.13.0" dokka = "1.9.20" espressoCore = "3.5.1" +jetbrainsNavigation = "2.8.0-dev1590" junit = "4.13.2" junitVersion = "1.1.5" kotlin = "1.9.23" +kotlinCoroutines = "1.8.0" kotlinpoet = "1.16.0" ksp = "1.9.23-1.0.20" ktlint = "0.50.0" lifecycleRuntimeKtx = "2.7.0" -navigationCompose = "2.7.7" +material3 = "1.3.0-alpha05" +navigationCompose = "2.8.0-alpha07" navigationComposeExtended = "0.3.0" spotless = "6.25.0" vanniktechMavenPublishPlugin = "0.28.0" @@ -24,14 +28,12 @@ vanniktechMavenPublishPlugin = "0.28.0" android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" } androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" } -androidx-compose-material3 = { module = "androidx.compose.material3:material3" } +androidx-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "material3" } androidx-compose-ui = { module = "androidx.compose.ui:ui" } androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" } -androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" } -androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" } androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" } -junit = { module = "junit:junit", version.ref = "junit" } +jetbrains-navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "jetbrainsNavigation" } kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } ksp-symbolProcessingApi = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" } spotless-gradlePlugin = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } @@ -41,6 +43,7 @@ squareup-kotlinpoetKsp = { module = "com.squareup:kotlinpoet-ksp", version.ref = [plugins] androidApplication = { id = "com.android.application", version.ref = "androidGradlePlugin" } androidLibrary = { id = "com.android.library", version.ref = "androidGradlePlugin" } +composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "composeMultiplatform" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } diff --git a/navigation-compose-extended/build.gradle.kts b/navigation-compose-extended/build.gradle.kts index 9df12b2..98094f8 100644 --- a/navigation-compose-extended/build.gradle.kts +++ b/navigation-compose-extended/build.gradle.kts @@ -1,8 +1,9 @@ import com.vanniktech.maven.publish.SonatypeHost plugins { + kotlin("multiplatform") + alias(libs.plugins.composeMultiplatform) alias(libs.plugins.androidLibrary) - kotlin("android") id("dev.sergiobelda.gradle.spotless") alias(libs.plugins.dokka) alias(libs.plugins.vanniktechMavenPublish) @@ -11,6 +12,36 @@ plugins { group = "dev.sergiobelda.navigation.compose.extended" version = libs.versions.navigationComposeExtended.get() +kotlin { + androidTarget() + jvm("desktop") + iosX64() + iosArm64() + iosSimulatorArm64() + + sourceSets { + val commonMain by getting { + dependencies { + implementation(libs.jetbrains.navigation.compose) + } + } + val commonTest by getting + val androidMain by getting + val androidUnitTest by getting + val desktopMain by getting + val desktopTest by getting + val iosX64Main by getting + val iosArm64Main by getting + val iosSimulatorArm64Main by getting + val iosMain by creating + val iosTest by creating + + all { + languageSettings.optIn("kotlin.RequiresOptIn") + } + } +} + android { namespace = "dev.sergiobelda.navigation.compose.extended" compileSdk = libs.versions.androidCompileSdk.get().toInt() @@ -21,28 +52,10 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") } - buildTypes { - release { - isMinifyEnabled = false - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" - ) - } - } + kotlin { jvmToolchain(17) } - buildFeatures { - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } -} - -dependencies { - implementation(libs.androidx.navigation.compose) } mavenPublishing { diff --git a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavAction.kt b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavAction.kt similarity index 83% rename from navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavAction.kt rename to navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavAction.kt index 481e937..84a34c3 100644 --- a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavAction.kt +++ b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavAction.kt @@ -60,17 +60,20 @@ class NavAction(private val navController: NavHostController) { navController.navigate( route = navRoute.route, navOptions = navOptions { - // Pop up to the start destination of the graph to - // avoid building up a large stack of destinations - // on the back stack as users select items - popUpTo(navController.graph.findStartDestination().id) { - saveState = true + navController.graph.findStartDestination().route?.let { + // Pop up to the start destination of the graph to + // avoid building up a large stack of destinations + // on the back stack as users select items + popUpTo(it) { + saveState = true + } + + // Avoid multiple copies of the same destination when + // reselecting the same item + launchSingleTop = true + // Restore state when reselecting a previously selected item + restoreState = true } - // Avoid multiple copies of the same destination when - // reselecting the same item - launchSingleTop = true - // Restore state when reselecting a previously selected item - restoreState = true }, navigatorExtras = navigatorExtras, ) diff --git a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavArgs.kt b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavArgs.kt similarity index 100% rename from navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavArgs.kt rename to navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavArgs.kt diff --git a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavArgumentKey.kt b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavArgumentKey.kt similarity index 100% rename from navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavArgumentKey.kt rename to navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavArgumentKey.kt diff --git a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavDestination.kt b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavDestination.kt similarity index 95% rename from navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavDestination.kt rename to navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavDestination.kt index 7953278..3f5cfd9 100644 --- a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavDestination.kt +++ b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavDestination.kt @@ -21,7 +21,6 @@ import androidx.navigation.NavArgumentBuilder import androidx.navigation.NavBackStackEntry import androidx.navigation.NavDeepLink import androidx.navigation.navArgument -import androidx.navigation.navDeepLink /** * Represents some Destination in the Navigation graph. It's defined by a @@ -56,9 +55,10 @@ abstract class NavDestination where K : NavArgumentKey { */ val deepLinks: List get() = deepLinkUris.map { - navDeepLink { - uriPattern = it + argumentsRoute - } + // navDeepLink { + // uriPattern = it + argumentsRoute + // } + NavDeepLink.Builder().setUriPattern(it + argumentsRoute).build() } /** diff --git a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavGraphBuilder.kt b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavGraphBuilder.kt similarity index 99% rename from navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavGraphBuilder.kt rename to navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavGraphBuilder.kt index b913ed9..cc2220f 100644 --- a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavGraphBuilder.kt +++ b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavGraphBuilder.kt @@ -30,6 +30,7 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.compose.dialog import androidx.navigation.compose.navigation +import kotlin.jvm.JvmSuppressWildcards /** * Add the [Composable] to the [NavGraphBuilder] diff --git a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavHost.kt b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavHost.kt similarity index 100% rename from navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavHost.kt rename to navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavHost.kt diff --git a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavRoute.kt b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavRoute.kt similarity index 100% rename from navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/NavRoute.kt rename to navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/NavRoute.kt diff --git a/navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/RouteConstants.kt b/navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/RouteConstants.kt similarity index 100% rename from navigation-compose-extended/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/RouteConstants.kt rename to navigation-compose-extended/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/RouteConstants.kt diff --git a/navigation-compose-extended/src/main/AndroidManifest.xml b/navigation-compose-extended/src/main/AndroidManifest.xml deleted file mode 100644 index 861919c..0000000 --- a/navigation-compose-extended/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/sample-app-annotations/src/main/AndroidManifest.xml b/sample-app-annotations/src/main/AndroidManifest.xml index 128d4c4..a392399 100644 --- a/sample-app-annotations/src/main/AndroidManifest.xml +++ b/sample-app-annotations/src/main/AndroidManifest.xml @@ -21,15 +21,23 @@ + - + + + - + + diff --git a/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/settings/SettingsScreen.kt b/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/settings/SettingsScreen.kt index 705016c..f3cd557 100644 --- a/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/settings/SettingsScreen.kt +++ b/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/settings/SettingsScreen.kt @@ -33,7 +33,10 @@ import dev.sergiobelda.navigation.compose.extended.compiler.annotation.NavDestin fun SettingsScreen( @NavArgument userId: Int, @NavArgument(defaultValue = "Default") text: String?, // Set default value for the NavArgument. - @NavArgument(name = "custom-name", defaultValue = "true") result: Boolean, // Set a custom NavArgument name. + @NavArgument( + name = "custom-name", + defaultValue = "true", + ) result: Boolean, // Set a custom NavArgument name. ) { Box(modifier = Modifier.fillMaxSize()) { Column { diff --git a/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Theme.kt b/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Theme.kt index 5568285..a524d3b 100644 --- a/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Theme.kt +++ b/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Theme.kt @@ -16,58 +16,14 @@ package dev.sergiobelda.navigation.compose.extended.sample.annotations.ui.theme -import android.os.Build -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.darkColorScheme -import androidx.compose.material3.dynamicDarkColorScheme -import androidx.compose.material3.dynamicLightColorScheme -import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable -import androidx.compose.ui.platform.LocalContext - -private val DarkColorScheme = darkColorScheme( - primary = Purple80, - secondary = PurpleGrey80, - tertiary = Pink80, -) - -private val LightColorScheme = lightColorScheme( - primary = Purple40, - secondary = PurpleGrey40, - tertiary = Pink40, - - /* Other default colors to override - background = Color(0xFFFFFBFE), - surface = Color(0xFFFFFBFE), - onPrimary = Color.White, - onSecondary = Color.White, - onTertiary = Color.White, - onBackground = Color(0xFF1C1B1F), - onSurface = Color(0xFF1C1B1F), - */ -) @Composable fun SampleTheme( - darkTheme: Boolean = isSystemInDarkTheme(), - // Dynamic color is available on Android 12+ - dynamicColor: Boolean = true, content: @Composable () -> Unit, ) { - val colorScheme = when { - dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - val context = LocalContext.current - if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) - } - - darkTheme -> DarkColorScheme - else -> LightColorScheme - } - MaterialTheme( - colorScheme = colorScheme, - typography = Typography, content = content, ) } diff --git a/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Type.kt b/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Type.kt deleted file mode 100644 index c042459..0000000 --- a/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Type.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2024 Sergio Belda - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.sergiobelda.navigation.compose.extended.sample.annotations.ui.theme - -import androidx.compose.material3.Typography -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.sp - -// Set of Material typography styles to start with -val Typography = Typography( - bodyLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 16.sp, - lineHeight = 24.sp, - letterSpacing = 0.5.sp, - ), - /* Other default text styles to override - titleLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 22.sp, - lineHeight = 28.sp, - letterSpacing = 0.sp - ), - labelSmall = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Medium, - fontSize = 11.sp, - lineHeight = 16.sp, - letterSpacing = 0.5.sp - ) - */ -) diff --git a/sample-app/build.gradle.kts b/sample-app/build.gradle.kts index 56ddeee..b7ca207 100644 --- a/sample-app/build.gradle.kts +++ b/sample-app/build.gradle.kts @@ -1,10 +1,58 @@ +import org.jetbrains.compose.desktop.application.dsl.TargetFormat + plugins { + kotlin("multiplatform") + alias(libs.plugins.composeMultiplatform) alias(libs.plugins.androidApplication) - kotlin("android") id("dev.sergiobelda.gradle.spotless") alias(libs.plugins.ksp) } +kotlin { + androidTarget() + jvm("desktop") { + compilations.all { + kotlin { + jvmToolchain(17) + } + } + } + listOf( + iosX64(), + iosArm64(), + iosSimulatorArm64() + ).forEach { iosTarget -> + iosTarget.binaries.framework { + baseName = "sample_app" + isStatic = true + } + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(projects.navigationComposeExtended) + implementation(compose.foundation) + implementation(compose.material3) + implementation(compose.runtime) + implementation(compose.ui) + + implementation(libs.jetbrains.navigation.compose) + } + } + val androidMain by getting { + dependencies { + implementation(libs.androidx.compose.material3) + } + } + val desktopMain by getting { + dependencies { + implementation(compose.desktop.currentOs) + } + } + } +} + android { namespace = "dev.sergiobelda.navigation.compose.extended.sample" compileSdk = libs.versions.androidCompileSdk.get().toInt() @@ -30,22 +78,13 @@ android { kotlin { jvmToolchain(17) } - buildFeatures { - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } } -dependencies { - implementation(libs.androidx.navigation.compose) - implementation(projects.navigationComposeExtended) - - implementation(platform(libs.androidx.compose.bom)) - implementation(libs.androidx.compose.material3) - implementation(libs.androidx.compose.ui) - implementation(libs.androidx.activity.compose) - implementation(libs.androidx.core.ktx) - implementation(libs.androidx.lifecycle.runtime.ktx) +compose.desktop { + application { + mainClass = "dev.sergiobelda.navigation.compose.extended.sample.ui.main.MainKt" + nativeDistributions { + targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + } + } } diff --git a/sample-app/src/main/AndroidManifest.xml b/sample-app/src/androidMain/AndroidManifest.xml similarity index 100% rename from sample-app/src/main/AndroidManifest.xml rename to sample-app/src/androidMain/AndroidManifest.xml diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/MainActivity.kt b/sample-app/src/androidMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/MainActivity.kt similarity index 87% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/MainActivity.kt rename to sample-app/src/androidMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/MainActivity.kt index dd76d7e..c1b7c4a 100644 --- a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/MainActivity.kt +++ b/sample-app/src/androidMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/MainActivity.kt @@ -20,16 +20,14 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge -import dev.sergiobelda.navigation.compose.extended.sample.ui.theme.SampleTheme +import dev.sergiobelda.navigation.compose.extended.sample.ui.SampleAppNavHost class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge() setContent { - SampleTheme { - MainScreen() - } + SampleAppNavHost() } } } diff --git a/sample-app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/sample-app/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from sample-app/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to sample-app/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml diff --git a/sample-app/src/main/res/drawable/ic_launcher_background.xml b/sample-app/src/androidMain/res/drawable/ic_launcher_background.xml similarity index 100% rename from sample-app/src/main/res/drawable/ic_launcher_background.xml rename to sample-app/src/androidMain/res/drawable/ic_launcher_background.xml diff --git a/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/sample-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to sample-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sample-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to sample-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/sample-app/src/main/res/mipmap-hdpi/ic_launcher.webp b/sample-app/src/androidMain/res/mipmap-hdpi/ic_launcher.webp similarity index 100% rename from sample-app/src/main/res/mipmap-hdpi/ic_launcher.webp rename to sample-app/src/androidMain/res/mipmap-hdpi/ic_launcher.webp diff --git a/sample-app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/sample-app/src/androidMain/res/mipmap-hdpi/ic_launcher_round.webp similarity index 100% rename from sample-app/src/main/res/mipmap-hdpi/ic_launcher_round.webp rename to sample-app/src/androidMain/res/mipmap-hdpi/ic_launcher_round.webp diff --git a/sample-app/src/main/res/mipmap-mdpi/ic_launcher.webp b/sample-app/src/androidMain/res/mipmap-mdpi/ic_launcher.webp similarity index 100% rename from sample-app/src/main/res/mipmap-mdpi/ic_launcher.webp rename to sample-app/src/androidMain/res/mipmap-mdpi/ic_launcher.webp diff --git a/sample-app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/sample-app/src/androidMain/res/mipmap-mdpi/ic_launcher_round.webp similarity index 100% rename from sample-app/src/main/res/mipmap-mdpi/ic_launcher_round.webp rename to sample-app/src/androidMain/res/mipmap-mdpi/ic_launcher_round.webp diff --git a/sample-app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/sample-app/src/androidMain/res/mipmap-xhdpi/ic_launcher.webp similarity index 100% rename from sample-app/src/main/res/mipmap-xhdpi/ic_launcher.webp rename to sample-app/src/androidMain/res/mipmap-xhdpi/ic_launcher.webp diff --git a/sample-app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/sample-app/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.webp similarity index 100% rename from sample-app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp rename to sample-app/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.webp diff --git a/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/sample-app/src/androidMain/res/mipmap-xxhdpi/ic_launcher.webp similarity index 100% rename from sample-app/src/main/res/mipmap-xxhdpi/ic_launcher.webp rename to sample-app/src/androidMain/res/mipmap-xxhdpi/ic_launcher.webp diff --git a/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/sample-app/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.webp similarity index 100% rename from sample-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp rename to sample-app/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.webp diff --git a/sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/sample-app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.webp similarity index 100% rename from sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp rename to sample-app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.webp diff --git a/sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/sample-app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.webp similarity index 100% rename from sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp rename to sample-app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.webp diff --git a/sample-app/src/main/res/values/strings.xml b/sample-app/src/androidMain/res/values/strings.xml similarity index 100% rename from sample-app/src/main/res/values/strings.xml rename to sample-app/src/androidMain/res/values/strings.xml diff --git a/sample-app/src/main/res/values/themes.xml b/sample-app/src/androidMain/res/values/themes.xml similarity index 100% rename from sample-app/src/main/res/values/themes.xml rename to sample-app/src/androidMain/res/values/themes.xml diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/MainScreen.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/SampleAppNavHost.kt similarity index 95% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/MainScreen.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/SampleAppNavHost.kt index d54afa0..182a0b6 100644 --- a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/MainScreen.kt +++ b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/SampleAppNavHost.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package dev.sergiobelda.navigation.compose.extended.sample.ui.main +package dev.sergiobelda.navigation.compose.extended.sample.ui import androidx.compose.runtime.Composable import androidx.navigation.compose.rememberNavController @@ -27,7 +27,7 @@ import dev.sergiobelda.navigation.compose.extended.sample.ui.settings.SettingsNa import dev.sergiobelda.navigation.compose.extended.sample.ui.settings.SettingsScreen @Composable -fun MainScreen() { +fun SampleAppNavHost() { val navController = rememberNavController() val navAction = rememberNavAction(navController) NavHost( diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeNavDestination.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeNavDestination.kt similarity index 100% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeNavDestination.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeNavDestination.kt diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeScreen.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeScreen.kt similarity index 94% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeScreen.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeScreen.kt index 8bc8983..64082fe 100644 --- a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeScreen.kt +++ b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/home/HomeScreen.kt @@ -16,7 +16,6 @@ package dev.sergiobelda.navigation.compose.extended.sample.ui.home -import androidx.annotation.StringRes import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding @@ -37,7 +36,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.stringResource import androidx.navigation.NavDestination.Companion.hierarchy import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.currentBackStackEntryAsState @@ -49,7 +47,6 @@ import dev.sergiobelda.navigation.compose.extended.NavHost import dev.sergiobelda.navigation.compose.extended.composable import dev.sergiobelda.navigation.compose.extended.navigation import dev.sergiobelda.navigation.compose.extended.rememberNavAction -import dev.sergiobelda.navigation.compose.extended.sample.R import dev.sergiobelda.navigation.compose.extended.sample.ui.search.SearchNavDestination import dev.sergiobelda.navigation.compose.extended.sample.ui.search.initial.SearchInitialNavDestination import dev.sergiobelda.navigation.compose.extended.sample.ui.search.initial.SearchInitialScreen @@ -62,10 +59,10 @@ import dev.sergiobelda.navigation.compose.extended.sample.ui.yourlibrary.YourLib private enum class HomeNavigationBarItem( val navDestination: NavDestination, val icon: ImageVector, - @StringRes val labelResId: Int, + val text: String, ) { - Search(SearchNavDestination, Icons.Rounded.Search, R.string.search), - YourLibrary(YourLibraryNavDestination, Icons.Rounded.AccountBox, R.string.your_library), + Search(SearchNavDestination, Icons.Rounded.Search, "Search"), + YourLibrary(YourLibraryNavDestination, Icons.Rounded.AccountBox, "Your library"), } @OptIn(ExperimentalMaterial3Api::class) @@ -97,7 +94,7 @@ fun HomeScreen( selected = currentDestination?.hierarchy?.any { it.route == item.navDestination.route } == true, onClick = { navAction.navigate(item.navDestination.navRoute()) }, icon = { Icon(item.icon, contentDescription = null) }, - label = { Text(text = stringResource(item.labelResId)) }, + label = { Text(text = item.text) }, ) } } diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/SearchNavDestination.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/SearchNavDestination.kt similarity index 100% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/SearchNavDestination.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/SearchNavDestination.kt diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialNavDestination.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialNavDestination.kt similarity index 100% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialNavDestination.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialNavDestination.kt diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialScreen.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialScreen.kt similarity index 88% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialScreen.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialScreen.kt index dc6721f..f611eb3 100644 --- a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialScreen.kt +++ b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/initial/SearchInitialScreen.kt @@ -16,7 +16,6 @@ package dev.sergiobelda.navigation.compose.extended.sample.ui.search.initial -import android.annotation.SuppressLint import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -38,11 +37,8 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import dev.sergiobelda.navigation.compose.extended.sample.R -@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") @OptIn(ExperimentalMaterial3Api::class) @Composable fun SearchInitialScreen( @@ -53,7 +49,7 @@ fun SearchInitialScreen( Scaffold( topBar = { TopAppBar( - title = { Text(text = stringResource(R.string.search)) }, + title = { Text(text = "Search") }, ) }, ) { paddingValues -> @@ -67,14 +63,14 @@ fun SearchInitialScreen( OutlinedTextField( value = search, onValueChange = { search = it }, - placeholder = { Text(text = stringResource(R.string.search_and_discover_music)) }, + placeholder = { Text(text = "Search and discover Music") }, modifier = Modifier .fillMaxWidth(), isError = isError, leadingIcon = { Icon( Icons.Rounded.Search, - contentDescription = stringResource(R.string.search), + contentDescription = "Search", ) }, supportingText = { diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultNavigation.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultNavigation.kt similarity index 100% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultNavigation.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultNavigation.kt diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultScreen.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultScreen.kt similarity index 91% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultScreen.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultScreen.kt index f145fc8..488fd92 100644 --- a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultScreen.kt +++ b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/search/result/SearchResultScreen.kt @@ -29,9 +29,7 @@ import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import dev.sergiobelda.navigation.compose.extended.sample.R @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -47,7 +45,7 @@ fun SearchResultScreen( IconButton(onClick = navigateBack) { Icon( Icons.AutoMirrored.Rounded.ArrowBack, - contentDescription = stringResource(R.string.back), + contentDescription = "Back", ) } }, diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/settings/SettingsNavDestination.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/settings/SettingsNavDestination.kt similarity index 100% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/settings/SettingsNavDestination.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/settings/SettingsNavDestination.kt diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/settings/SettingsScreen.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/settings/SettingsScreen.kt similarity index 100% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/settings/SettingsScreen.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/settings/SettingsScreen.kt diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryNavDestination.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryNavDestination.kt similarity index 100% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryNavDestination.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryNavDestination.kt diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryScreen.kt b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryScreen.kt similarity index 85% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryScreen.kt rename to sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryScreen.kt index 5bf14fc..e647e24 100644 --- a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryScreen.kt +++ b/sample-app/src/commonMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/yourlibrary/YourLibraryScreen.kt @@ -21,8 +21,6 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable -import androidx.compose.ui.res.stringResource -import dev.sergiobelda.navigation.compose.extended.sample.R @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -30,7 +28,7 @@ fun YourLibraryScreen() { Scaffold( topBar = { TopAppBar( - title = { Text(text = stringResource(R.string.your_library)) }, + title = { Text(text = "Your library") }, ) }, ) { paddingValues -> diff --git a/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Color.kt b/sample-app/src/desktopMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/Main.kt similarity index 59% rename from sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Color.kt rename to sample-app/src/desktopMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/Main.kt index edf902a..f720377 100644 --- a/sample-app-annotations/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/annotations/ui/theme/Color.kt +++ b/sample-app/src/desktopMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/Main.kt @@ -14,14 +14,18 @@ * limitations under the License. */ -package dev.sergiobelda.navigation.compose.extended.sample.annotations.ui.theme +package dev.sergiobelda.navigation.compose.extended.sample.ui.main -import androidx.compose.ui.graphics.Color +import androidx.compose.ui.window.Window +import androidx.compose.ui.window.application +import dev.sergiobelda.navigation.compose.extended.sample.ui.SampleAppNavHost -val Purple80 = Color(0xFFD0BCFF) -val PurpleGrey80 = Color(0xFFCCC2DC) -val Pink80 = Color(0xFFEFB8C8) - -val Purple40 = Color(0xFF6650a4) -val PurpleGrey40 = Color(0xFF625b71) -val Pink40 = Color(0xFF7D5260) +fun main() = application { + Window( + resizable = false, + onCloseRequest = ::exitApplication, + title = "Sample App", + ) { + SampleAppNavHost() + } +} diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/theme/Color.kt b/sample-app/src/iosMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/Main.kt similarity index 63% rename from sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/theme/Color.kt rename to sample-app/src/iosMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/Main.kt index 39782c3..eb354f1 100644 --- a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/theme/Color.kt +++ b/sample-app/src/iosMain/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/main/Main.kt @@ -14,14 +14,12 @@ * limitations under the License. */ -package dev.sergiobelda.navigation.compose.extended.sample.ui.theme +package dev.sergiobelda.navigation.compose.extended.sample.ui.main -import androidx.compose.ui.graphics.Color +import androidx.compose.ui.window.ComposeUIViewController +import dev.sergiobelda.navigation.compose.extended.sample.ui.SampleAppNavHost +import platform.UIKit.UIViewController -val Purple80 = Color(0xFFD0BCFF) -val PurpleGrey80 = Color(0xFFCCC2DC) -val Pink80 = Color(0xFFEFB8C8) - -val Purple40 = Color(0xFF6650a4) -val PurpleGrey40 = Color(0xFF625b71) -val Pink40 = Color(0xFF7D5260) +fun MainViewController(): UIViewController = ComposeUIViewController { + SampleAppNavHost() +} diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/theme/Theme.kt b/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/theme/Theme.kt deleted file mode 100644 index 42e0e3b..0000000 --- a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/theme/Theme.kt +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2024 Sergio Belda - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.sergiobelda.navigation.compose.extended.sample.ui.theme - -import android.os.Build -import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.darkColorScheme -import androidx.compose.material3.dynamicDarkColorScheme -import androidx.compose.material3.dynamicLightColorScheme -import androidx.compose.material3.lightColorScheme -import androidx.compose.runtime.Composable -import androidx.compose.ui.platform.LocalContext - -private val DarkColorScheme = darkColorScheme( - primary = Purple80, - secondary = PurpleGrey80, - tertiary = Pink80, -) - -private val LightColorScheme = lightColorScheme( - primary = Purple40, - secondary = PurpleGrey40, - tertiary = Pink40, - - /* Other default colors to override - background = Color(0xFFFFFBFE), - surface = Color(0xFFFFFBFE), - onPrimary = Color.White, - onSecondary = Color.White, - onTertiary = Color.White, - onBackground = Color(0xFF1C1B1F), - onSurface = Color(0xFF1C1B1F), - */ -) - -@Composable -fun SampleTheme( - darkTheme: Boolean = isSystemInDarkTheme(), - // Dynamic color is available on Android 12+ - dynamicColor: Boolean = true, - content: @Composable () -> Unit, -) { - val colorScheme = when { - dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - val context = LocalContext.current - if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) - } - - darkTheme -> DarkColorScheme - else -> LightColorScheme - } - - MaterialTheme( - colorScheme = colorScheme, - typography = Typography, - content = content, - ) -} diff --git a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/theme/Type.kt b/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/theme/Type.kt deleted file mode 100644 index 4ea4f64..0000000 --- a/sample-app/src/main/kotlin/dev/sergiobelda/navigation/compose/extended/sample/ui/theme/Type.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2024 Sergio Belda - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.sergiobelda.navigation.compose.extended.sample.ui.theme - -import androidx.compose.material3.Typography -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.sp - -// Set of Material typography styles to start with -val Typography = Typography( - bodyLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 16.sp, - lineHeight = 24.sp, - letterSpacing = 0.5.sp, - ), - /* Other default text styles to override - titleLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 22.sp, - lineHeight = 28.sp, - letterSpacing = 0.sp - ), - labelSmall = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Medium, - fontSize = 11.sp, - lineHeight = 16.sp, - letterSpacing = 0.5.sp - ) - */ -) diff --git a/sampleiOSApp/sampleiOSApp.xcodeproj/project.pbxproj b/sampleiOSApp/sampleiOSApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000..36ec19e --- /dev/null +++ b/sampleiOSApp/sampleiOSApp.xcodeproj/project.pbxproj @@ -0,0 +1,374 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 42FC630F2BD2D2DD00C254F5 /* sampleiOSAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42FC630E2BD2D2DD00C254F5 /* sampleiOSAppApp.swift */; }; + 42FC63112BD2D2DD00C254F5 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42FC63102BD2D2DD00C254F5 /* ContentView.swift */; }; + 42FC63132BD2D2DE00C254F5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 42FC63122BD2D2DE00C254F5 /* Assets.xcassets */; }; + 42FC63162BD2D2DE00C254F5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 42FC63152BD2D2DE00C254F5 /* Preview Assets.xcassets */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 42FC630B2BD2D2DD00C254F5 /* sampleiOSApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = sampleiOSApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 42FC630E2BD2D2DD00C254F5 /* sampleiOSAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = sampleiOSAppApp.swift; sourceTree = ""; }; + 42FC63102BD2D2DD00C254F5 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 42FC63122BD2D2DE00C254F5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 42FC63152BD2D2DE00C254F5 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 42FC63082BD2D2DD00C254F5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 42FC63022BD2D2DD00C254F5 = { + isa = PBXGroup; + children = ( + 42FC630D2BD2D2DD00C254F5 /* sampleiOSApp */, + 42FC630C2BD2D2DD00C254F5 /* Products */, + ); + sourceTree = ""; + }; + 42FC630C2BD2D2DD00C254F5 /* Products */ = { + isa = PBXGroup; + children = ( + 42FC630B2BD2D2DD00C254F5 /* sampleiOSApp.app */, + ); + name = Products; + sourceTree = ""; + }; + 42FC630D2BD2D2DD00C254F5 /* sampleiOSApp */ = { + isa = PBXGroup; + children = ( + 42FC630E2BD2D2DD00C254F5 /* sampleiOSAppApp.swift */, + 42FC63102BD2D2DD00C254F5 /* ContentView.swift */, + 42FC63122BD2D2DE00C254F5 /* Assets.xcassets */, + 42FC63142BD2D2DE00C254F5 /* Preview Content */, + ); + path = sampleiOSApp; + sourceTree = ""; + }; + 42FC63142BD2D2DE00C254F5 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 42FC63152BD2D2DE00C254F5 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 42FC630A2BD2D2DD00C254F5 /* sampleiOSApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 42FC63192BD2D2DE00C254F5 /* Build configuration list for PBXNativeTarget "sampleiOSApp" */; + buildPhases = ( + 42FC631C2BD2D34200C254F5 /* ShellScript */, + 42FC63072BD2D2DD00C254F5 /* Sources */, + 42FC63082BD2D2DD00C254F5 /* Frameworks */, + 42FC63092BD2D2DD00C254F5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = sampleiOSApp; + productName = sampleiOSApp; + productReference = 42FC630B2BD2D2DD00C254F5 /* sampleiOSApp.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 42FC63032BD2D2DD00C254F5 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1520; + LastUpgradeCheck = 1520; + TargetAttributes = { + 42FC630A2BD2D2DD00C254F5 = { + CreatedOnToolsVersion = 15.2; + }; + }; + }; + buildConfigurationList = 42FC63062BD2D2DD00C254F5 /* Build configuration list for PBXProject "sampleiOSApp" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 42FC63022BD2D2DD00C254F5; + productRefGroup = 42FC630C2BD2D2DD00C254F5 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 42FC630A2BD2D2DD00C254F5 /* sampleiOSApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 42FC63092BD2D2DD00C254F5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 42FC63162BD2D2DE00C254F5 /* Preview Assets.xcassets in Resources */, + 42FC63132BD2D2DE00C254F5 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 42FC631C2BD2D34200C254F5 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd \"$SRCROOT/..\"\n./gradlew :sample-app:embedAndSignAppleFrameworkForXcode\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 42FC63072BD2D2DD00C254F5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 42FC63112BD2D2DD00C254F5 /* ContentView.swift in Sources */, + 42FC630F2BD2D2DD00C254F5 /* sampleiOSAppApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 42FC63172BD2D2DE00C254F5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 42FC63182BD2D2DE00C254F5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 42FC631A2BD2D2DE00C254F5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"sampleiOSApp/Preview Content\""; + DEVELOPMENT_TEAM = 9B3DS6JXG9; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../sample-app/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.sergiobelda.navigation.compose.extended.sample.sampleiOSApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 42FC631B2BD2D2DE00C254F5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"sampleiOSApp/Preview Content\""; + DEVELOPMENT_TEAM = 9B3DS6JXG9; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../sample-app/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.sergiobelda.navigation.compose.extended.sample.sampleiOSApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 42FC63062BD2D2DD00C254F5 /* Build configuration list for PBXProject "sampleiOSApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 42FC63172BD2D2DE00C254F5 /* Debug */, + 42FC63182BD2D2DE00C254F5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 42FC63192BD2D2DE00C254F5 /* Build configuration list for PBXNativeTarget "sampleiOSApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 42FC631A2BD2D2DE00C254F5 /* Debug */, + 42FC631B2BD2D2DE00C254F5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 42FC63032BD2D2DD00C254F5 /* Project object */; +} diff --git a/sampleiOSApp/sampleiOSApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/sampleiOSApp/sampleiOSApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/sampleiOSApp/sampleiOSApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/sampleiOSApp/sampleiOSApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/sampleiOSApp/sampleiOSApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/sampleiOSApp/sampleiOSApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/sampleiOSApp/sampleiOSApp.xcodeproj/project.xcworkspace/xcuserdata/sergiobelda.xcuserdatad/UserInterfaceState.xcuserstate b/sampleiOSApp/sampleiOSApp.xcodeproj/project.xcworkspace/xcuserdata/sergiobelda.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..808b20a Binary files /dev/null and b/sampleiOSApp/sampleiOSApp.xcodeproj/project.xcworkspace/xcuserdata/sergiobelda.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/sampleiOSApp/sampleiOSApp.xcodeproj/xcuserdata/sergiobelda.xcuserdatad/xcschemes/xcschememanagement.plist b/sampleiOSApp/sampleiOSApp.xcodeproj/xcuserdata/sergiobelda.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..6292379 --- /dev/null +++ b/sampleiOSApp/sampleiOSApp.xcodeproj/xcuserdata/sergiobelda.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + sampleiOSApp.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/sampleiOSApp/sampleiOSApp/Assets.xcassets/AccentColor.colorset/Contents.json b/sampleiOSApp/sampleiOSApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/sampleiOSApp/sampleiOSApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/sampleiOSApp/sampleiOSApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/sampleiOSApp/sampleiOSApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..13613e3 --- /dev/null +++ b/sampleiOSApp/sampleiOSApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/sampleiOSApp/sampleiOSApp/Assets.xcassets/Contents.json b/sampleiOSApp/sampleiOSApp/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/sampleiOSApp/sampleiOSApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/sampleiOSApp/sampleiOSApp/ContentView.swift b/sampleiOSApp/sampleiOSApp/ContentView.swift new file mode 100644 index 0000000..93774f9 --- /dev/null +++ b/sampleiOSApp/sampleiOSApp/ContentView.swift @@ -0,0 +1,24 @@ +// +// ContentView.swift +// sampleiOSApp +// +// Created by Sergio Belda Galbis on 19/4/24. +// + +import SwiftUI +import sample_app + +struct ContentView: View { + var body: some View { + ComposeView().ignoresSafeArea(.all) // Compose has own keyboard handler + } +} + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + MainKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) { + } +} diff --git a/sampleiOSApp/sampleiOSApp/Preview Content/Preview Assets.xcassets/Contents.json b/sampleiOSApp/sampleiOSApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/sampleiOSApp/sampleiOSApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/sampleiOSApp/sampleiOSApp/sampleiOSAppApp.swift b/sampleiOSApp/sampleiOSApp/sampleiOSAppApp.swift new file mode 100644 index 0000000..053b2e1 --- /dev/null +++ b/sampleiOSApp/sampleiOSApp/sampleiOSAppApp.swift @@ -0,0 +1,17 @@ +// +// sampleiOSAppApp.swift +// sampleiOSApp +// +// Created by Sergio Belda Galbis on 19/4/24. +// + +import SwiftUI + +@main +struct sampleiOSAppApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index ca362be..0bf32ae 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,10 +7,11 @@ pluginManagement { } } dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositoriesMode.set(RepositoriesMode.PREFER_PROJECT) repositories { google() mavenCentral() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } } enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")