├── iosApp ├── iosApp │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── AppIcon.appiconset │ │ │ ├── app-icon-1024.png │ │ │ └── Contents.json │ │ └── AccentColor.colorset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── iOSApp.swift │ ├── ContentView.swift │ └── Info.plist ├── Configuration │ └── Config.xcconfig └── iosApp.xcodeproj │ └── project.pbxproj ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── composeApp ├── src │ ├── androidMain │ │ ├── res │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ │ └── com │ │ │ └── santimattius │ │ │ └── kmp │ │ │ └── skeleton │ │ │ ├── core │ │ │ └── ui │ │ │ │ └── components │ │ │ │ └── networkimage.common.android.kt │ │ │ └── MainActivity.kt │ ├── commonMain │ │ ├── kotlin │ │ │ ├── com │ │ │ │ └── santimattius │ │ │ │ │ └── kmp │ │ │ │ │ └── skeleton │ │ │ │ │ ├── di │ │ │ │ │ ├── AppQualifiers.kt │ │ │ │ │ └── Dependencies.kt │ │ │ │ │ ├── core │ │ │ │ │ ├── domain │ │ │ │ │ │ └── Picture.kt │ │ │ │ │ ├── ui │ │ │ │ │ │ ├── themes │ │ │ │ │ │ │ ├── Color.kt │ │ │ │ │ │ │ ├── Type.kt │ │ │ │ │ │ │ └── Theme.kt │ │ │ │ │ │ └── components │ │ │ │ │ │ │ ├── networkimage.common.kt │ │ │ │ │ │ │ ├── Center.kt │ │ │ │ │ │ │ └── AppBar.kt │ │ │ │ │ ├── data │ │ │ │ │ │ ├── Picture.kt │ │ │ │ │ │ ├── PictureRepository.kt │ │ │ │ │ │ └── SettingsRepository.kt │ │ │ │ │ ├── preferences │ │ │ │ │ │ ├── SettingConfig.kt │ │ │ │ │ │ └── IntSettingConfig.kt │ │ │ │ │ └── network │ │ │ │ │ │ └── Client.kt │ │ │ │ │ ├── MainApplication.kt │ │ │ │ │ └── features │ │ │ │ │ ├── home │ │ │ │ │ ├── HomeScreenModel.kt │ │ │ │ │ └── HomeScreen.kt │ │ │ │ │ └── splash │ │ │ │ │ └── SplashScreen.kt │ │ │ └── App.kt │ │ └── resources │ │ │ └── compose-multiplatform.xml │ └── iosMain │ │ └── kotlin │ │ ├── MainViewController.kt │ │ └── com │ │ └── santimattius │ │ └── kmp │ │ └── skeleton │ │ └── core │ │ └── ui │ │ └── components │ │ └── networkimage.common.ios.kt └── build.gradle.kts ├── .gitignore ├── gradle.properties ├── .fleet └── receipt.json ├── settings.gradle.kts ├── README.md ├── gradlew.bat └── gradlew /iosApp/iosApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | kmp-compose-gradle-skeleton 3 | -------------------------------------------------------------------------------- /iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } -------------------------------------------------------------------------------- /iosApp/Configuration/Config.xcconfig: -------------------------------------------------------------------------------- 1 | TEAM_ID= 2 | BUNDLE_ID=com.santimattius.kmp.compose.skeleton.kmp-compose-gradle-skeleton 3 | APP_NAME=kmp-compose-gradle-skeleton -------------------------------------------------------------------------------- /iosApp/iosApp/iOSApp.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | @main 4 | struct iOSApp: App { 5 | var body: some Scene { 6 | WindowGroup { 7 | ContentView() 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/di/AppQualifiers.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.di 2 | 3 | enum class AppQualifiers { 4 | Client, 5 | BaseUrl 6 | } -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/santimattius/kmp-shared-preferences/HEAD/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/domain/Picture.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.domain 2 | 3 | data class Picture( 4 | val id: String, 5 | val author: String, 6 | val url: String, 7 | ) 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "app-icon-1024.png", 5 | "idiom" : "universal", 6 | "platform" : "ios", 7 | "size" : "1024x1024" 8 | } 9 | ], 10 | "info" : { 11 | "author" : "xcode", 12 | "version" : 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | **/build/ 4 | xcuserdata 5 | !src/**/build/ 6 | local.properties 7 | .idea 8 | .DS_Store 9 | captures 10 | .externalNativeBuild 11 | .cxx 12 | *.xcodeproj/* 13 | !*.xcodeproj/project.pbxproj 14 | !*.xcodeproj/xcshareddata/ 15 | !*.xcodeproj/project.xcworkspace/ 16 | !*.xcworkspace/contents.xcworkspacedata 17 | **/xcshareddata/WorkspaceSettings.xcsettings 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | 3 | #Gradle 4 | org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" 5 | 6 | 7 | #Android 8 | android.nonTransitiveRClass=true 9 | android.useAndroidX=true 10 | 11 | #MPP 12 | kotlin.mpp.androidSourceSetLayoutVersion=2 13 | kotlin.mpp.enableCInteropCommonization=true 14 | 15 | #Development 16 | development=true -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/ui/themes/Color.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.entertainment.core.ui.themes 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | val Purple80 = Color(0xFFD0BCFF) 6 | val PurpleGrey80 = Color(0xFFCCC2DC) 7 | val Pink80 = Color(0xFFEFB8C8) 8 | 9 | val Purple40 = Color(0xFF6650a4) 10 | val PurpleGrey40 = Color(0xFF625b71) 11 | val Pink40 = Color(0xFF7D5260) -------------------------------------------------------------------------------- /.fleet/receipt.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec": { 3 | "template_id": "kmt", 4 | "targets": { 5 | "android": { 6 | "ui": [ 7 | "compose" 8 | ] 9 | }, 10 | "ios": { 11 | "ui": [ 12 | "compose" 13 | ] 14 | } 15 | } 16 | }, 17 | "timestamp": "2023-12-12T11:51:15.531908775Z" 18 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/MainApplication.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton 2 | 3 | import androidx.compose.runtime.Composable 4 | import cafe.adriel.voyager.navigator.Navigator 5 | import com.santimattius.kmp.skeleton.core.ui.themes.AppTheme 6 | import com.santimattius.kmp.skeleton.features.splash.SplashScreen 7 | 8 | @Composable 9 | fun MainApplication() { 10 | AppTheme { 11 | Navigator(SplashScreen) 12 | } 13 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/App.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.runtime.Composable 2 | import com.santimattius.kmp.skeleton.MainApplication 3 | import com.santimattius.kmp.skeleton.di.applicationModules 4 | import org.koin.compose.KoinApplication 5 | import org.koin.core.module.Module 6 | 7 | @Composable 8 | fun App(platformModules: List = emptyList()) { 9 | KoinApplication(moduleList = { applicationModules() + platformModules }) { 10 | MainApplication() 11 | } 12 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/data/Picture.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.data 2 | 3 | 4 | import kotlinx.serialization.SerialName 5 | import kotlinx.serialization.Serializable 6 | 7 | @Serializable 8 | data class Picture( 9 | @SerialName("id") val id: String, 10 | @SerialName("author") val author: String, 11 | @SerialName("width") val width: Long, 12 | @SerialName("height") val height: Long, 13 | @SerialName("url") val url: String, 14 | @SerialName("download_url") val downloadURL: String, 15 | ) 16 | -------------------------------------------------------------------------------- /composeApp/src/iosMain/kotlin/MainViewController.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.ui.window.ComposeUIViewController 2 | import com.russhwolf.settings.NSUserDefaultsSettings 3 | import com.russhwolf.settings.Settings 4 | import org.koin.dsl.module 5 | import platform.Foundation.NSUserDefaults 6 | 7 | fun MainViewController() = ComposeUIViewController { App(iosPlatformModules) } 8 | 9 | 10 | val iosModule = module { 11 | single { 12 | NSUserDefaultsSettings(NSUserDefaults.standardUserDefaults) 13 | } 14 | } 15 | 16 | val iosPlatformModules = listOf(iosModule) -------------------------------------------------------------------------------- /iosApp/iosApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SwiftUI 3 | import ComposeApp 4 | 5 | struct ComposeView: UIViewControllerRepresentable { 6 | func makeUIViewController(context: Context) -> UIViewController { 7 | MainViewControllerKt.MainViewController() 8 | } 9 | 10 | func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} 11 | } 12 | 13 | struct ContentView: View { 14 | var body: some View { 15 | ComposeView().edgesIgnoringSafeArea(.top) // Compose has own keyboard handler 16 | } 17 | } 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "kmp-shared-preferences" 2 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") 3 | 4 | pluginManagement { 5 | repositories { 6 | maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 7 | google() 8 | gradlePluginPortal() 9 | mavenCentral() 10 | } 11 | } 12 | 13 | dependencyResolutionManagement { 14 | repositories { 15 | google() 16 | mavenCentral() 17 | maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 18 | } 19 | } 20 | 21 | include(":composeApp") -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/ui/themes/Type.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.entertainment.core.ui.themes 2 | 3 | import androidx.compose.material3.Typography 4 | import androidx.compose.ui.text.TextStyle 5 | import androidx.compose.ui.text.font.FontFamily 6 | import androidx.compose.ui.text.font.FontWeight 7 | import androidx.compose.ui.unit.sp 8 | 9 | val Typography = Typography( 10 | bodyLarge = TextStyle( 11 | fontFamily = FontFamily.Default, 12 | fontWeight = FontWeight.Normal, 13 | fontSize = 16.sp, 14 | lineHeight = 24.sp, 15 | letterSpacing = 0.5.sp 16 | ) 17 | ) -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/data/PictureRepository.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.data 2 | 3 | import io.ktor.client.HttpClient 4 | import io.ktor.client.call.body 5 | import io.ktor.client.request.get 6 | import com.santimattius.kmp.skeleton.core.domain.Picture as DomainPicture 7 | 8 | private fun Picture.asDomain(): DomainPicture { 9 | return DomainPicture(this.id, this.author, this.downloadURL) 10 | } 11 | 12 | class PictureRepository( 13 | private val client: HttpClient, 14 | ) { 15 | suspend fun random() = runCatching { 16 | val response = client.get("/random") 17 | response.body().asDomain() 18 | } 19 | } -------------------------------------------------------------------------------- /composeApp/src/iosMain/kotlin/com/santimattius/kmp/skeleton/core/ui/components/networkimage.common.ios.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.ui.components 2 | 3 | import androidx.compose.foundation.Image 4 | import androidx.compose.runtime.Composable 5 | import androidx.compose.ui.Modifier 6 | import androidx.compose.ui.layout.ContentScale 7 | import com.seiko.imageloader.rememberImagePainter 8 | 9 | @Composable 10 | internal actual fun __NetworkImage( 11 | imageUrl: String, 12 | modifier: Modifier, 13 | contentScale: ContentScale, 14 | contentDescription: String?, 15 | ) { 16 | 17 | val painter = rememberImagePainter(imageUrl) 18 | Image( 19 | modifier = modifier, 20 | painter = painter, 21 | contentDescription = contentDescription, 22 | contentScale = contentScale 23 | ) 24 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/data/SettingsRepository.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.data 2 | 3 | import com.russhwolf.settings.Settings 4 | import com.santimattius.kmp.skeleton.core.preferences.IntSettingConfig 5 | import kotlinx.coroutines.flow.Flow 6 | 7 | class SettingsRepository( 8 | settings: Settings, 9 | ) { 10 | 11 | 12 | private val _counter = IntSettingConfig(settings, "counter", 0) 13 | val counter: Flow = _counter.value 14 | 15 | fun increment() { 16 | val value = _counter.get().toInt() + 1 17 | _counter.set("$value") 18 | } 19 | 20 | fun decrease() { 21 | val value = _counter.get().toInt() - 1 22 | if (value < 0) { 23 | _counter.set("0") 24 | } else { 25 | _counter.set("$value") 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/ui/components/networkimage.common.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.ui.components 2 | 3 | import androidx.compose.runtime.Composable 4 | import androidx.compose.ui.Modifier 5 | import androidx.compose.ui.layout.ContentScale 6 | 7 | @Composable 8 | internal expect fun __NetworkImage( 9 | imageUrl: String, 10 | modifier: Modifier, 11 | contentScale: ContentScale, 12 | contentDescription: String?, 13 | ) 14 | 15 | @Composable 16 | internal fun NetworkImage( 17 | imageUrl: String, 18 | modifier: Modifier = Modifier, 19 | contentScale: ContentScale, 20 | contentDescription: String? = null, 21 | ) { 22 | __NetworkImage( 23 | imageUrl = imageUrl, 24 | modifier = modifier, 25 | contentScale = contentScale, 26 | contentDescription = contentDescription 27 | ) 28 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/ui/components/Center.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.ui.components 2 | 3 | import androidx.compose.foundation.layout.Box 4 | import androidx.compose.foundation.layout.fillMaxSize 5 | import androidx.compose.material3.CircularProgressIndicator 6 | import androidx.compose.material3.Text 7 | import androidx.compose.runtime.Composable 8 | import androidx.compose.ui.Alignment 9 | import androidx.compose.ui.Modifier 10 | 11 | @Composable 12 | private fun Center(content: @Composable () -> Unit) { 13 | Box( 14 | modifier = Modifier.fillMaxSize(), 15 | contentAlignment = Alignment.Center 16 | ) { 17 | content() 18 | } 19 | } 20 | 21 | @Composable 22 | fun LoadingIndicator() { 23 | Center { 24 | CircularProgressIndicator() 25 | } 26 | } 27 | 28 | @Composable 29 | fun ErrorView(message: String) { 30 | Center { Text(message) } 31 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/preferences/SettingConfig.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.preferences 2 | 3 | import com.russhwolf.settings.Settings 4 | import kotlinx.coroutines.flow.Flow 5 | 6 | sealed class SettingConfig( 7 | protected val settings: Settings, 8 | val key: String, 9 | protected val defaultValue: T, 10 | ) { 11 | protected abstract fun getStringValue(settings: Settings, key: String, defaultValue: T): String 12 | protected abstract fun setStringValue(settings: Settings, key: String, value: String) 13 | 14 | fun remove() = settings.remove(key) 15 | fun exists(): Boolean = settings.hasKey(key) 16 | 17 | fun get(): String = getStringValue(settings, key, defaultValue) 18 | fun set(value: String): Boolean { 19 | return try { 20 | setStringValue(settings, key, value) 21 | true 22 | } catch (exception: Exception) { 23 | false 24 | } 25 | } 26 | 27 | override fun toString() = key 28 | 29 | abstract val value: Flow 30 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/features/home/HomeScreenModel.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.features.home 2 | 3 | import cafe.adriel.voyager.core.model.StateScreenModel 4 | import cafe.adriel.voyager.core.model.screenModelScope 5 | import com.santimattius.kmp.skeleton.core.data.SettingsRepository 6 | import kotlinx.coroutines.flow.SharingStarted 7 | import kotlinx.coroutines.flow.map 8 | import kotlinx.coroutines.flow.stateIn 9 | 10 | 11 | data class HomeUiState( 12 | val isLoading: Boolean = false, 13 | val hasError: Boolean = false, 14 | val data: Int = 0, 15 | ) 16 | 17 | class HomeScreenModel( 18 | private val settingsRepository: SettingsRepository, 19 | ) : StateScreenModel(HomeUiState()) { 20 | 21 | val uiState = settingsRepository.counter.map { HomeUiState(data = it) }.stateIn( 22 | scope = screenModelScope, 23 | started = SharingStarted.WhileSubscribed(5_000), 24 | initialValue = HomeUiState(), 25 | ) 26 | 27 | fun desc() = settingsRepository.decrease() 28 | 29 | 30 | fun inc() = settingsRepository.increment() 31 | } 32 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/network/Client.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.network 2 | 3 | import io.ktor.client.HttpClient 4 | import io.ktor.client.plugins.contentnegotiation.ContentNegotiation 5 | import io.ktor.client.plugins.defaultRequest 6 | import io.ktor.client.plugins.logging.DEFAULT 7 | import io.ktor.client.plugins.logging.LogLevel 8 | import io.ktor.client.plugins.logging.Logger 9 | import io.ktor.client.plugins.logging.Logging 10 | import io.ktor.http.ContentType 11 | import io.ktor.http.contentType 12 | import io.ktor.serialization.kotlinx.json.json 13 | import kotlinx.serialization.json.Json 14 | 15 | internal fun ktorHttpClient(baseUrl: String) = HttpClient { 16 | 17 | install(ContentNegotiation) { 18 | json(Json { 19 | prettyPrint = true 20 | isLenient = true 21 | ignoreUnknownKeys = true 22 | }) 23 | } 24 | install(Logging) { 25 | logger = Logger.DEFAULT 26 | level = LogLevel.ALL 27 | } 28 | 29 | defaultRequest { 30 | url(baseUrl) 31 | contentType(ContentType.Application.Json) 32 | } 33 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/di/Dependencies.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.di 2 | 3 | import com.santimattius.kmp.skeleton.core.data.PictureRepository 4 | import com.santimattius.kmp.skeleton.core.data.SettingsRepository 5 | import com.santimattius.kmp.skeleton.core.network.ktorHttpClient 6 | import com.santimattius.kmp.skeleton.features.home.HomeScreenModel 7 | import org.koin.core.qualifier.qualifier 8 | import org.koin.dsl.module 9 | 10 | val sharedModules = module { 11 | single(qualifier(AppQualifiers.BaseUrl)) { "https://api-picture.onrender.com" } 12 | single(qualifier(AppQualifiers.Client)) { 13 | ktorHttpClient( 14 | baseUrl = get( 15 | qualifier = qualifier( 16 | AppQualifiers.BaseUrl 17 | ) 18 | ) 19 | ) 20 | } 21 | 22 | single { PictureRepository(get(qualifier(AppQualifiers.Client))) } 23 | single { SettingsRepository(get()) } 24 | } 25 | 26 | val homeModule = module { 27 | factory { HomeScreenModel(settingsRepository = get()) } 28 | } 29 | 30 | 31 | fun applicationModules() = listOf(sharedModules, homeModule) -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/preferences/IntSettingConfig.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.preferences 2 | 3 | import com.russhwolf.settings.ExperimentalSettingsApi 4 | import com.russhwolf.settings.ObservableSettings 5 | import com.russhwolf.settings.Settings 6 | import com.russhwolf.settings.coroutines.getIntFlow 7 | import kotlinx.coroutines.flow.Flow 8 | import kotlinx.coroutines.flow.emptyFlow 9 | 10 | class IntSettingConfig(settings: Settings, key: String, defaultValue: Int) : 11 | SettingConfig(settings, key, defaultValue) { 12 | 13 | @OptIn(ExperimentalSettingsApi::class) 14 | override val value: Flow 15 | get() { 16 | val observableSettings = settings as? ObservableSettings ?: return emptyFlow() 17 | return observableSettings.getIntFlow(key, defaultValue) 18 | } 19 | 20 | override fun getStringValue(settings: Settings, key: String, defaultValue: Int): String = 21 | settings.getInt(key, defaultValue).toString() 22 | 23 | override fun setStringValue(settings: Settings, key: String, value: String) = 24 | settings.putInt(key, value.toInt()) 25 | } -------------------------------------------------------------------------------- /composeApp/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/kotlin/com/santimattius/kmp/skeleton/core/ui/components/networkimage.common.android.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.ui.components 2 | 3 | import androidx.compose.foundation.layout.Box 4 | import androidx.compose.foundation.layout.size 5 | import androidx.compose.material3.CircularProgressIndicator 6 | import androidx.compose.material3.MaterialTheme 7 | import androidx.compose.runtime.Composable 8 | import androidx.compose.ui.Alignment 9 | import androidx.compose.ui.Modifier 10 | import androidx.compose.ui.layout.ContentScale 11 | import androidx.compose.ui.unit.dp 12 | import coil.compose.SubcomposeAsyncImage 13 | 14 | @Composable 15 | internal actual fun __NetworkImage( 16 | imageUrl: String, 17 | modifier: Modifier, 18 | contentScale: ContentScale, 19 | contentDescription: String?, 20 | ) { 21 | SubcomposeAsyncImage( 22 | model = imageUrl, 23 | loading = { 24 | Box(contentAlignment = Alignment.Center) { 25 | CircularProgressIndicator( 26 | color = MaterialTheme.colorScheme.secondary, 27 | modifier = Modifier.size(32.dp) 28 | ) 29 | } 30 | }, 31 | contentDescription = contentDescription, 32 | contentScale = contentScale, 33 | modifier = modifier 34 | ) 35 | } -------------------------------------------------------------------------------- /composeApp/src/androidMain/kotlin/com/santimattius/kmp/skeleton/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton 2 | 3 | import App 4 | import android.content.SharedPreferences 5 | import android.os.Bundle 6 | import androidx.activity.ComponentActivity 7 | import androidx.activity.compose.setContent 8 | import androidx.compose.runtime.Composable 9 | import androidx.compose.ui.platform.LocalContext 10 | import androidx.compose.ui.tooling.preview.Preview 11 | import androidx.preference.PreferenceManager 12 | import com.russhwolf.settings.Settings 13 | import com.russhwolf.settings.SharedPreferencesSettings 14 | import org.koin.dsl.module 15 | 16 | class MainActivity : ComponentActivity() { 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | setContent { 20 | val preferences = PreferenceManager.getDefaultSharedPreferences(LocalContext.current) 21 | App(androidPlatformModules(preferences)) 22 | } 23 | } 24 | } 25 | 26 | @Preview 27 | @Composable 28 | fun AppAndroidPreview() { 29 | App() 30 | } 31 | 32 | fun androidModule(sharedPref: SharedPreferences) = module { 33 | single { 34 | SharedPreferencesSettings(sharedPref) 35 | } 36 | } 37 | 38 | fun androidPlatformModules(sharedPref: SharedPreferences) = listOf(androidModule(sharedPref)) 39 | 40 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/ui/components/AppBar.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.ui.components 2 | 3 | import androidx.compose.foundation.layout.RowScope 4 | import androidx.compose.material3.ExperimentalMaterial3Api 5 | import androidx.compose.material3.MaterialTheme 6 | import androidx.compose.material3.Text 7 | import androidx.compose.material3.TopAppBar 8 | import androidx.compose.material3.TopAppBarDefaults 9 | import androidx.compose.runtime.Composable 10 | import androidx.compose.ui.graphics.Color 11 | 12 | 13 | @OptIn(ExperimentalMaterial3Api::class) 14 | @Composable 15 | fun AppBar( 16 | title: String = "", 17 | navigationIcon: @Composable () -> Unit = { }, 18 | containerColor: Color = MaterialTheme.colorScheme.primary, 19 | titleContentColor: Color = MaterialTheme.colorScheme.onPrimary, 20 | actions: @Composable RowScope.() -> Unit = {}, 21 | ) { 22 | TopAppBar( 23 | title = { Text(text = title) }, 24 | navigationIcon = navigationIcon, 25 | colors = TopAppBarDefaults.centerAlignedTopAppBarColors( 26 | containerColor = containerColor, 27 | titleContentColor = titleContentColor, 28 | navigationIconContentColor = titleContentColor, 29 | actionIconContentColor = titleContentColor, 30 | ), 31 | actions = actions 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/core/ui/themes/Theme.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.core.ui.themes 2 | 3 | import androidx.compose.foundation.isSystemInDarkTheme 4 | import androidx.compose.material3.MaterialTheme 5 | import androidx.compose.material3.darkColorScheme 6 | import androidx.compose.material3.lightColorScheme 7 | import androidx.compose.runtime.Composable 8 | import androidx.compose.ui.graphics.Color 9 | import com.santimattius.kmp.entertainment.core.ui.themes.Pink40 10 | import com.santimattius.kmp.entertainment.core.ui.themes.Pink80 11 | import com.santimattius.kmp.entertainment.core.ui.themes.Purple40 12 | import com.santimattius.kmp.entertainment.core.ui.themes.Purple80 13 | import com.santimattius.kmp.entertainment.core.ui.themes.PurpleGrey40 14 | import com.santimattius.kmp.entertainment.core.ui.themes.PurpleGrey80 15 | import com.santimattius.kmp.entertainment.core.ui.themes.Typography 16 | 17 | private val DarkColorScheme = darkColorScheme( 18 | primary = Purple80, 19 | secondary = PurpleGrey80, 20 | tertiary = Pink80 21 | ) 22 | 23 | private val LightColorScheme = lightColorScheme( 24 | primary = Purple40, 25 | secondary = PurpleGrey40, 26 | tertiary = Pink40, 27 | onPrimary = Color.White, 28 | background = Color.White 29 | ) 30 | 31 | @Composable 32 | fun AppTheme( 33 | darkTheme: Boolean = isSystemInDarkTheme(), 34 | content: @Composable () -> Unit, 35 | ) { 36 | val colorScheme = if (darkTheme) DarkColorScheme else LightColorScheme 37 | MaterialTheme( 38 | colorScheme = colorScheme, 39 | typography = Typography, 40 | content = content 41 | ) 42 | } -------------------------------------------------------------------------------- /iosApp/iosApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | CADisableMinimumFrameDurationOnPhone 24 | 25 | UIApplicationSceneManifest 26 | 27 | UIApplicationSupportsMultipleScenes 28 | 29 | 30 | UILaunchScreen 31 | 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/features/splash/SplashScreen.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.features.splash 2 | 3 | import androidx.compose.animation.core.Animatable 4 | import androidx.compose.animation.core.Spring 5 | import androidx.compose.animation.core.spring 6 | import androidx.compose.foundation.Image 7 | import androidx.compose.foundation.layout.Box 8 | import androidx.compose.foundation.layout.fillMaxSize 9 | import androidx.compose.runtime.Composable 10 | import androidx.compose.runtime.LaunchedEffect 11 | import androidx.compose.runtime.remember 12 | import androidx.compose.ui.Alignment 13 | import androidx.compose.ui.Modifier 14 | import cafe.adriel.voyager.core.screen.Screen 15 | import cafe.adriel.voyager.navigator.LocalNavigator 16 | import cafe.adriel.voyager.navigator.currentOrThrow 17 | import com.santimattius.kmp.skeleton.features.home.HomeScreen 18 | import kotlinx.coroutines.delay 19 | import org.jetbrains.compose.resources.ExperimentalResourceApi 20 | import org.jetbrains.compose.resources.painterResource 21 | 22 | object SplashScreen : Screen { 23 | @Composable 24 | override fun Content() { 25 | val navigator = LocalNavigator.currentOrThrow 26 | SplashScreenContent { 27 | navigator.replace(HomeScreen) 28 | } 29 | } 30 | } 31 | 32 | @OptIn(ExperimentalResourceApi::class) 33 | @Composable 34 | fun SplashScreenContent(navigate: () -> Unit) { 35 | val scale = remember { 36 | Animatable(0f) 37 | } 38 | 39 | LaunchedEffect(key1 = true) { 40 | scale.animateTo( 41 | targetValue = 0.7f, 42 | animationSpec = spring( 43 | dampingRatio = Spring.DampingRatioHighBouncy, 44 | stiffness = 1000f 45 | ) 46 | ) 47 | delay(800L) 48 | navigate() 49 | } 50 | 51 | Box( 52 | contentAlignment = Alignment.Center, 53 | modifier = Modifier.fillMaxSize() 54 | ) { 55 | Image( 56 | painterResource("compose-multiplatform.xml"), 57 | null 58 | ) 59 | } 60 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KMP SharedPreferences Example 2 | 3 | Example using [Multiplaform Settings](https://github.com/russhwolf/multiplatform-settings/tree/main) 4 | 5 | 6 | 7 | https://github.com/santimattius/kmp-shared-preferences/assets/22333101/d17f41b3-5702-4483-bb82-f8ca7872ea99 8 | 9 | 10 | 11 | This is a Kotlin Multiplatform project targeting Android, iOS. 12 | 13 | * `/composeApp` is for code that will be shared across your Compose Multiplatform applications. 14 | It contains several subfolders: 15 | - `commonMain` is for code that’s common for all targets. 16 | - Other folders are for Kotlin code that will be compiled for only the platform indicated in the 17 | folder name. 18 | For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app, 19 | `iosMain` would be the right folder for such calls. 20 | 21 | * `/iosApp` contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform, 22 | you need this entry point for your iOS app. This is also where you should add SwiftUI code for 23 | your project. 24 | 25 | ## Prepare the environment 26 | 27 | - Install and configure the latest JDK 17+. 28 | - If you have Gradle installed, make sure you use Gradle 8.1 or later. 29 | - Install and configure the latest Android Studio for Android samples. 30 | - Install and configure the latest Xcode for iOS samples. 31 | 32 | Use the [KDoctor](https://github.com/Kotlin/kdoctor) tool to ensure that your development 33 | environment is configured correctly: 34 | 35 | 1. Install KDoctor with [Homebrew](https://brew.sh/): 36 | 37 | ```text 38 | brew install kdoctor 39 | ``` 40 | 41 | 2. Run KDoctor in your terminal: 42 | 43 | ```text 44 | kdoctor 45 | ``` 46 | 47 | If everything is set up correctly, you'll see valid output: 48 | 49 | ```text 50 | Environment diagnose (to see all details, use -v option): 51 | [✓] Operation System 52 | [✓] Java 53 | [✓] Android Studio 54 | [✓] Xcode 55 | [✓] Cocoapods 56 | 57 | Conclusion: 58 | ✓ Your system is ready for Kotlin Multiplatform Mobile development! 59 | ``` 60 | 61 | Otherwise, KDoctor will highlight which parts of your setup still need to be configured and will 62 | suggest a way to fix 63 | them. 64 | 65 | Learn more 66 | about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html) 67 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/com/santimattius/kmp/skeleton/features/home/HomeScreen.kt: -------------------------------------------------------------------------------- 1 | package com.santimattius.kmp.skeleton.features.home 2 | 3 | import androidx.compose.foundation.layout.Arrangement 4 | import androidx.compose.foundation.layout.Box 5 | import androidx.compose.foundation.layout.Column 6 | import androidx.compose.foundation.layout.Row 7 | import androidx.compose.foundation.layout.fillMaxSize 8 | import androidx.compose.foundation.layout.padding 9 | import androidx.compose.material.icons.Icons 10 | import androidx.compose.material.icons.filled.Add 11 | import androidx.compose.material.icons.filled.Remove 12 | import androidx.compose.material3.Button 13 | import androidx.compose.material3.Icon 14 | import androidx.compose.material3.MaterialTheme 15 | import androidx.compose.material3.Scaffold 16 | import androidx.compose.material3.Text 17 | import androidx.compose.runtime.Composable 18 | import androidx.compose.runtime.collectAsState 19 | import androidx.compose.runtime.getValue 20 | import androidx.compose.ui.Alignment 21 | import androidx.compose.ui.Modifier 22 | import androidx.compose.ui.unit.dp 23 | import cafe.adriel.voyager.core.screen.Screen 24 | import cafe.adriel.voyager.koin.getScreenModel 25 | import com.santimattius.kmp.skeleton.core.ui.components.AppBar 26 | 27 | object HomeScreen : Screen { 28 | 29 | @Composable 30 | override fun Content() { 31 | val screenModel = getScreenModel() 32 | HomeScreenContent(screenModel) 33 | } 34 | } 35 | 36 | @Composable 37 | fun HomeScreenContent( 38 | screenModel: HomeScreenModel, 39 | ) { 40 | val state by screenModel.uiState.collectAsState() 41 | Scaffold( 42 | topBar = { AppBar(title = "Shared Preferences") }, 43 | ) { 44 | Box( 45 | modifier = Modifier.fillMaxSize().padding(it), 46 | contentAlignment = Alignment.Center 47 | ) { 48 | Column(horizontalAlignment = Alignment.CenterHorizontally) { 49 | Text("Counter value", style = MaterialTheme.typography.displaySmall) 50 | Text("${state.data}", style = MaterialTheme.typography.displayMedium) 51 | Row( 52 | modifier = Modifier.padding(top = 16.dp), 53 | horizontalArrangement = Arrangement.spacedBy(8.dp) 54 | ) { 55 | Button(enabled = state.data > 0, onClick = { screenModel.desc() }) { 56 | Icon(Icons.Default.Remove, contentDescription = null) 57 | } 58 | Button(onClick = { screenModel.inc() }) { 59 | Icon(Icons.Default.Add, contentDescription = null) 60 | } 61 | } 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /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. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 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. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 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 | -------------------------------------------------------------------------------- /composeApp/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.compose.ExperimentalComposeLibrary 2 | 3 | plugins { 4 | alias(libs.plugins.kotlinMultiplatform) 5 | alias(libs.plugins.androidApplication) 6 | alias(libs.plugins.jetbrainsCompose) 7 | alias(libs.plugins.kotlinSerialization) 8 | } 9 | 10 | kotlin { 11 | androidTarget { 12 | compilations.all { 13 | kotlinOptions { 14 | jvmTarget = JavaVersion.VERSION_1_8.toString() 15 | } 16 | } 17 | } 18 | 19 | listOf( 20 | iosX64(), 21 | iosArm64(), 22 | iosSimulatorArm64() 23 | ).forEach { iosTarget -> 24 | iosTarget.binaries.framework { 25 | baseName = "ComposeApp" 26 | isStatic = true 27 | } 28 | } 29 | 30 | sourceSets { 31 | 32 | androidMain.dependencies { 33 | implementation(libs.compose.ui.tooling.preview) 34 | implementation(libs.androidx.activity.compose) 35 | 36 | api(libs.androidx.activity.compose) 37 | api(libs.androidx.appcompat) 38 | api(libs.androidx.core.ktx) 39 | 40 | implementation(libs.coil.compose) 41 | 42 | implementation(libs.ktor.client.okhttp) 43 | implementation(libs.kotlinx.coroutines.android) 44 | 45 | implementation(libs.koin.android) 46 | implementation(libs.androidx.preference.ktx) 47 | } 48 | val commonMain by getting { 49 | dependencies { 50 | implementation(compose.runtime) 51 | implementation(compose.foundation) 52 | implementation(compose.material) 53 | implementation(compose.material3) 54 | implementation(compose.materialIconsExtended) 55 | implementation(compose.ui) 56 | @OptIn(ExperimentalComposeLibrary::class) 57 | implementation(compose.components.resources) 58 | 59 | implementation(libs.voyager.navigator) 60 | implementation(libs.voyager.koin) 61 | 62 | implementation(libs.ktor.client.core) 63 | implementation(libs.ktor.client.content.negotiation) 64 | implementation(libs.ktor.client.logging) 65 | implementation(libs.ktor.serialization.kotlinx.json) 66 | implementation(libs.kotlinx.coroutines.core) 67 | 68 | api(libs.koin.core) 69 | api(libs.koin.compose) 70 | 71 | implementation(libs.multiplatform.settings) 72 | implementation(libs.multiplatform.settings.coroutines) 73 | 74 | } 75 | } 76 | 77 | val iosX64Main by getting 78 | val iosArm64Main by getting 79 | val iosSimulatorArm64Main by getting 80 | val iosMain by creating { 81 | dependsOn(commonMain) 82 | iosX64Main.dependsOn(this) 83 | iosArm64Main.dependsOn(this) 84 | iosSimulatorArm64Main.dependsOn(this) 85 | dependencies { 86 | implementation(libs.image.loader) 87 | implementation(libs.ktor.client.darwin) 88 | } 89 | } 90 | } 91 | } 92 | 93 | android { 94 | namespace = "com.santimattius.kmp.compose.skeleton" 95 | compileSdk = libs.versions.android.compileSdk.get().toInt() 96 | 97 | sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") 98 | sourceSets["main"].res.srcDirs("src/androidMain/res") 99 | sourceSets["main"].resources.srcDirs("src/commonMain/resources") 100 | 101 | defaultConfig { 102 | applicationId = "com.santimattius.kmp.compose.skeleton" 103 | minSdk = libs.versions.android.minSdk.get().toInt() 104 | targetSdk = libs.versions.android.targetSdk.get().toInt() 105 | versionCode = 1 106 | versionName = "1.0" 107 | } 108 | packaging { 109 | resources { 110 | excludes += "/META-INF/{AL2.0,LGPL2.1}" 111 | } 112 | } 113 | buildTypes { 114 | getByName("release") { 115 | isMinifyEnabled = false 116 | } 117 | } 118 | compileOptions { 119 | sourceCompatibility = JavaVersion.VERSION_1_8 120 | targetCompatibility = JavaVersion.VERSION_1_8 121 | } 122 | dependencies { 123 | debugImplementation(libs.compose.ui.tooling) 124 | } 125 | } 126 | 127 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/resources/compose-multiplatform.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 18 | 24 | 30 | 36 | 37 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | agp = "8.2.0" 3 | android-compileSdk = "34" 4 | android-minSdk = "24" 5 | android-targetSdk = "34" 6 | androidx-activityCompose = "1.8.2" 7 | androidx-appcompat = "1.6.1" 8 | androidx-constraintlayout = "2.1.4" 9 | androidx-core-ktx = "1.12.0" 10 | androidx-espresso-core = "3.5.1" 11 | androidx-material = "1.11.0" 12 | androidx-test-junit = "1.1.5" 13 | compose = "1.5.4" 14 | compose-compiler = "1.5.5" 15 | compose-plugin = "1.5.11" 16 | junit = "4.13.2" 17 | kotlin = "1.9.21" 18 | 19 | multiplatformSettings = "1.1.1" 20 | preferenceKtx = "1.2.1" 21 | voyager = "1.0.0-rc10" 22 | coil-compose = "2.5.0" 23 | image-loader = "1.6.4" 24 | 25 | koin = "3.5.0" 26 | koinCompose = "1.1.0" 27 | 28 | kotlinxCoroutinesAndroid = "1.7.3" 29 | ktorVersion = "2.3.7" 30 | 31 | [libraries] 32 | androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preferenceKtx" } 33 | kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } 34 | kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } 35 | junit = { group = "junit", name = "junit", version.ref = "junit" } 36 | androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" } 37 | androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-junit" } 38 | androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-espresso-core" } 39 | androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" } 40 | androidx-material = { group = "com.google.android.material", name = "material", version.ref = "androidx-material" } 41 | androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" } 42 | androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } 43 | compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } 44 | compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } 45 | compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } 46 | compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" } 47 | compose-material = { module = "androidx.compose.material:material", version.ref = "compose" } 48 | 49 | multiplatform-settings = { module = "com.russhwolf:multiplatform-settings", version.ref = "multiplatformSettings" } 50 | multiplatform-settings-coroutines = { module = "com.russhwolf:multiplatform-settings-coroutines", version.ref = "multiplatformSettings" } 51 | voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" } 52 | voyager-koin = { module = "cafe.adriel.voyager:voyager-koin", version.ref = "voyager" } 53 | 54 | coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" } 55 | image-loader = { group = "io.github.qdsfdhvh", name = "image-loader", version.ref = "image-loader" } 56 | 57 | koin-core = {module="io.insert-koin:koin-core", version.ref="koin"} 58 | koin-compose = {module="io.insert-koin:koin-compose", version.ref="koinCompose"} 59 | koin-android = {module="io.insert-koin:koin-android", version.ref="koin"} 60 | 61 | kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesAndroid" } 62 | kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" } 63 | ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktorVersion" } 64 | ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktorVersion" } 65 | ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktorVersion" } 66 | ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktorVersion" } 67 | ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktorVersion" } 68 | ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktorVersion" } 69 | 70 | [plugins] 71 | androidApplication = { id = "com.android.application", version.ref = "agp" } 72 | androidLibrary = { id = "com.android.library", version.ref = "agp" } 73 | jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" } 74 | kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } 75 | kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /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 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 87 | 88 | # Use the maximum available, or set MAX_FD != -1 to use that value. 89 | MAX_FD=maximum 90 | 91 | warn () { 92 | echo "$*" 93 | } >&2 94 | 95 | die () { 96 | echo 97 | echo "$*" 98 | echo 99 | exit 1 100 | } >&2 101 | 102 | # OS specific support (must be 'true' or 'false'). 103 | cygwin=false 104 | msys=false 105 | darwin=false 106 | nonstop=false 107 | case "$( uname )" in #( 108 | CYGWIN* ) cygwin=true ;; #( 109 | Darwin* ) darwin=true ;; #( 110 | MSYS* | MINGW* ) msys=true ;; #( 111 | NONSTOP* ) nonstop=true ;; 112 | esac 113 | 114 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 115 | 116 | 117 | # Determine the Java command to use to start the JVM. 118 | if [ -n "$JAVA_HOME" ] ; then 119 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 120 | # IBM's JDK on AIX uses strange locations for the executables 121 | JAVACMD=$JAVA_HOME/jre/sh/java 122 | else 123 | JAVACMD=$JAVA_HOME/bin/java 124 | fi 125 | if [ ! -x "$JAVACMD" ] ; then 126 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 127 | 128 | Please set the JAVA_HOME variable in your environment to match the 129 | location of your Java installation." 130 | fi 131 | else 132 | JAVACMD=java 133 | if ! command -v java >/dev/null 2>&1 134 | then 135 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 136 | 137 | Please set the JAVA_HOME variable in your environment to match the 138 | location of your Java installation." 139 | fi 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 147 | # shellcheck disable=SC3045 148 | MAX_FD=$( ulimit -H -n ) || 149 | warn "Could not query maximum file descriptor limit" 150 | esac 151 | case $MAX_FD in #( 152 | '' | soft) :;; #( 153 | *) 154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 155 | # shellcheck disable=SC3045 156 | ulimit -n "$MAX_FD" || 157 | warn "Could not set maximum file descriptor limit to $MAX_FD" 158 | esac 159 | fi 160 | 161 | # Collect all arguments for the java command, stacking in reverse order: 162 | # * args from the command line 163 | # * the main class name 164 | # * -classpath 165 | # * -D...appname settings 166 | # * --module-path (only if needed) 167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 168 | 169 | # For Cygwin or MSYS, switch paths to Windows format before running java 170 | if "$cygwin" || "$msys" ; then 171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 173 | 174 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 175 | 176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 177 | for arg do 178 | if 179 | case $arg in #( 180 | -*) false ;; # don't mess with options #( 181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 182 | [ -e "$t" ] ;; #( 183 | *) false ;; 184 | esac 185 | then 186 | arg=$( cygpath --path --ignore --mixed "$arg" ) 187 | fi 188 | # Roll the args list around exactly as many times as the number of 189 | # args, so each arg winds up back in the position where it started, but 190 | # possibly modified. 191 | # 192 | # NB: a `for` loop captures its iteration list before it begins, so 193 | # changing the positional parameters here affects neither the number of 194 | # iterations, nor the values presented in `arg`. 195 | shift # remove old arg 196 | set -- "$@" "$arg" # push replacement arg 197 | done 198 | fi 199 | 200 | 201 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 202 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 203 | 204 | # Collect all arguments for the java command; 205 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 206 | # shell script including quotes and variable substitutions, so put them in 207 | # double quotes to make sure that they get re-expanded; and 208 | # * put everything else in single quotes, so that it's not re-expanded. 209 | 210 | set -- \ 211 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 212 | -classpath "$CLASSPATH" \ 213 | org.gradle.wrapper.GradleWrapperMain \ 214 | "$@" 215 | 216 | # Stop when "xargs" is not available. 217 | if ! command -v xargs >/dev/null 2>&1 218 | then 219 | die "xargs is not available" 220 | fi 221 | 222 | # Use "xargs" to parse quoted args. 223 | # 224 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 225 | # 226 | # In Bash we could simply go: 227 | # 228 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 229 | # set -- "${ARGS[@]}" "$@" 230 | # 231 | # but POSIX shell has neither arrays nor command substitution, so instead we 232 | # post-process each arg (as a line of input to sed) to backslash-escape any 233 | # character that might be a shell metacharacter, then use eval to reverse 234 | # that process (while maintaining the separation between arguments), and wrap 235 | # the whole thing up as a single "set" statement. 236 | # 237 | # This will of course break if any of these variables contains a newline or 238 | # an unmatched quote. 239 | # 240 | 241 | eval "set -- $( 242 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 243 | xargs -n1 | 244 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 245 | tr '\n' ' ' 246 | )" '"$@"' 247 | 248 | exec "$JAVACMD" "$@" 249 | -------------------------------------------------------------------------------- /iosApp/iosApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; 11 | 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; 12 | 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; 13 | 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 18 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 19 | 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; 20 | 7555FF7B242A565900829871 /* .app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = .app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 22 | 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; 24 | /* End PBXFileReference section */ 25 | 26 | /* Begin PBXGroup section */ 27 | 058557D7273AAEEB004C7B11 /* Preview Content */ = { 28 | isa = PBXGroup; 29 | children = ( 30 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */, 31 | ); 32 | path = "Preview Content"; 33 | sourceTree = ""; 34 | }; 35 | 42799AB246E5F90AF97AA0EF /* Frameworks */ = { 36 | isa = PBXGroup; 37 | children = ( 38 | ); 39 | name = Frameworks; 40 | sourceTree = ""; 41 | }; 42 | 7555FF72242A565900829871 = { 43 | isa = PBXGroup; 44 | children = ( 45 | AB1DB47929225F7C00F7AF9C /* Configuration */, 46 | 7555FF7D242A565900829871 /* iosApp */, 47 | 7555FF7C242A565900829871 /* Products */, 48 | 42799AB246E5F90AF97AA0EF /* Frameworks */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | 7555FF7C242A565900829871 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 7555FF7B242A565900829871 /* .app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | 7555FF7D242A565900829871 /* iosApp */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 058557BA273AAA24004C7B11 /* Assets.xcassets */, 64 | 7555FF82242A565900829871 /* ContentView.swift */, 65 | 7555FF8C242A565B00829871 /* Info.plist */, 66 | 2152FB032600AC8F00CF470E /* iOSApp.swift */, 67 | 058557D7273AAEEB004C7B11 /* Preview Content */, 68 | ); 69 | path = iosApp; 70 | sourceTree = ""; 71 | }; 72 | AB1DB47929225F7C00F7AF9C /* Configuration */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | AB3632DC29227652001CCB65 /* Config.xcconfig */, 76 | ); 77 | path = Configuration; 78 | sourceTree = ""; 79 | }; 80 | /* End PBXGroup section */ 81 | 82 | /* Begin PBXNativeTarget section */ 83 | 7555FF7A242A565900829871 /* iosApp */ = { 84 | isa = PBXNativeTarget; 85 | buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; 86 | buildPhases = ( 87 | F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */, 88 | 7555FF77242A565900829871 /* Sources */, 89 | 7555FF79242A565900829871 /* Resources */, 90 | ); 91 | buildRules = ( 92 | ); 93 | dependencies = ( 94 | ); 95 | name = iosApp; 96 | productName = iosApp; 97 | productReference = 7555FF7B242A565900829871 /* .app */; 98 | productType = "com.apple.product-type.application"; 99 | }; 100 | /* End PBXNativeTarget section */ 101 | 102 | /* Begin PBXProject section */ 103 | 7555FF73242A565900829871 /* Project object */ = { 104 | isa = PBXProject; 105 | attributes = { 106 | LastSwiftUpdateCheck = 1130; 107 | LastUpgradeCheck = 1130; 108 | ORGANIZATIONNAME = orgName; 109 | TargetAttributes = { 110 | 7555FF7A242A565900829871 = { 111 | CreatedOnToolsVersion = 11.3.1; 112 | }; 113 | }; 114 | }; 115 | buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; 116 | compatibilityVersion = "Xcode 9.3"; 117 | developmentRegion = en; 118 | hasScannedForEncodings = 0; 119 | knownRegions = ( 120 | en, 121 | Base, 122 | ); 123 | mainGroup = 7555FF72242A565900829871; 124 | productRefGroup = 7555FF7C242A565900829871 /* Products */; 125 | projectDirPath = ""; 126 | projectRoot = ""; 127 | targets = ( 128 | 7555FF7A242A565900829871 /* iosApp */, 129 | ); 130 | }; 131 | /* End PBXProject section */ 132 | 133 | /* Begin PBXResourcesBuildPhase section */ 134 | 7555FF79242A565900829871 /* Resources */ = { 135 | isa = PBXResourcesBuildPhase; 136 | buildActionMask = 2147483647; 137 | files = ( 138 | 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */, 139 | 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */, 140 | ); 141 | runOnlyForDeploymentPostprocessing = 0; 142 | }; 143 | /* End PBXResourcesBuildPhase section */ 144 | 145 | /* Begin PBXShellScriptBuildPhase section */ 146 | F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */ = { 147 | isa = PBXShellScriptBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | ); 151 | inputFileListPaths = ( 152 | ); 153 | inputPaths = ( 154 | ); 155 | name = "Compile Kotlin Framework"; 156 | outputFileListPaths = ( 157 | ); 158 | outputPaths = ( 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | shellPath = /bin/sh; 162 | shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n"; 163 | }; 164 | /* End PBXShellScriptBuildPhase section */ 165 | 166 | /* Begin PBXSourcesBuildPhase section */ 167 | 7555FF77242A565900829871 /* Sources */ = { 168 | isa = PBXSourcesBuildPhase; 169 | buildActionMask = 2147483647; 170 | files = ( 171 | 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, 172 | 7555FF83242A565900829871 /* ContentView.swift in Sources */, 173 | ); 174 | runOnlyForDeploymentPostprocessing = 0; 175 | }; 176 | /* End PBXSourcesBuildPhase section */ 177 | 178 | /* Begin XCBuildConfiguration section */ 179 | 7555FFA3242A565B00829871 /* Debug */ = { 180 | isa = XCBuildConfiguration; 181 | baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; 182 | buildSettings = { 183 | ALWAYS_SEARCH_USER_PATHS = NO; 184 | CLANG_ANALYZER_NONNULL = YES; 185 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 186 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 187 | CLANG_CXX_LIBRARY = "libc++"; 188 | CLANG_ENABLE_MODULES = YES; 189 | CLANG_ENABLE_OBJC_ARC = YES; 190 | CLANG_ENABLE_OBJC_WEAK = YES; 191 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 192 | CLANG_WARN_BOOL_CONVERSION = YES; 193 | CLANG_WARN_COMMA = YES; 194 | CLANG_WARN_CONSTANT_CONVERSION = YES; 195 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 196 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 197 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 198 | CLANG_WARN_EMPTY_BODY = YES; 199 | CLANG_WARN_ENUM_CONVERSION = YES; 200 | CLANG_WARN_INFINITE_RECURSION = YES; 201 | CLANG_WARN_INT_CONVERSION = YES; 202 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 203 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 204 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 205 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 206 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 207 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 208 | CLANG_WARN_STRICT_PROTOTYPES = YES; 209 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 210 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 211 | CLANG_WARN_UNREACHABLE_CODE = YES; 212 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 213 | COPY_PHASE_STRIP = NO; 214 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 215 | ENABLE_STRICT_OBJC_MSGSEND = YES; 216 | ENABLE_TESTABILITY = YES; 217 | GCC_C_LANGUAGE_STANDARD = gnu11; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_NO_COMMON_BLOCKS = YES; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PREPROCESSOR_DEFINITIONS = ( 222 | "DEBUG=1", 223 | "$(inherited)", 224 | ); 225 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 227 | GCC_WARN_UNDECLARED_SELECTOR = YES; 228 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 229 | GCC_WARN_UNUSED_FUNCTION = YES; 230 | GCC_WARN_UNUSED_VARIABLE = YES; 231 | IPHONEOS_DEPLOYMENT_TARGET = 14.1; 232 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 233 | MTL_FAST_MATH = YES; 234 | ONLY_ACTIVE_ARCH = YES; 235 | SDKROOT = iphoneos; 236 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 237 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 238 | }; 239 | name = Debug; 240 | }; 241 | 7555FFA4242A565B00829871 /* Release */ = { 242 | isa = XCBuildConfiguration; 243 | baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; 244 | buildSettings = { 245 | ALWAYS_SEARCH_USER_PATHS = NO; 246 | CLANG_ANALYZER_NONNULL = YES; 247 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 248 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 249 | CLANG_CXX_LIBRARY = "libc++"; 250 | CLANG_ENABLE_MODULES = YES; 251 | CLANG_ENABLE_OBJC_ARC = YES; 252 | CLANG_ENABLE_OBJC_WEAK = YES; 253 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 254 | CLANG_WARN_BOOL_CONVERSION = YES; 255 | CLANG_WARN_COMMA = YES; 256 | CLANG_WARN_CONSTANT_CONVERSION = YES; 257 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 258 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 259 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 260 | CLANG_WARN_EMPTY_BODY = YES; 261 | CLANG_WARN_ENUM_CONVERSION = YES; 262 | CLANG_WARN_INFINITE_RECURSION = YES; 263 | CLANG_WARN_INT_CONVERSION = YES; 264 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 265 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 266 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 267 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 268 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 269 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 270 | CLANG_WARN_STRICT_PROTOTYPES = YES; 271 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 272 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 273 | CLANG_WARN_UNREACHABLE_CODE = YES; 274 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 275 | COPY_PHASE_STRIP = NO; 276 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 277 | ENABLE_NS_ASSERTIONS = NO; 278 | ENABLE_STRICT_OBJC_MSGSEND = YES; 279 | GCC_C_LANGUAGE_STANDARD = gnu11; 280 | GCC_NO_COMMON_BLOCKS = YES; 281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 283 | GCC_WARN_UNDECLARED_SELECTOR = YES; 284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 285 | GCC_WARN_UNUSED_FUNCTION = YES; 286 | GCC_WARN_UNUSED_VARIABLE = YES; 287 | IPHONEOS_DEPLOYMENT_TARGET = 14.1; 288 | MTL_ENABLE_DEBUG_INFO = NO; 289 | MTL_FAST_MATH = YES; 290 | SDKROOT = iphoneos; 291 | SWIFT_COMPILATION_MODE = wholemodule; 292 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 293 | VALIDATE_PRODUCT = YES; 294 | }; 295 | name = Release; 296 | }; 297 | 7555FFA6242A565B00829871 /* Debug */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 301 | CODE_SIGN_IDENTITY = "Apple Development"; 302 | CODE_SIGN_STYLE = Automatic; 303 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; 304 | DEVELOPMENT_TEAM = "${TEAM_ID}"; 305 | ENABLE_PREVIEWS = YES; 306 | FRAMEWORK_SEARCH_PATHS = ( 307 | "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)", 308 | ); 309 | INFOPLIST_FILE = iosApp/Info.plist; 310 | IPHONEOS_DEPLOYMENT_TARGET = 14.1; 311 | LD_RUNPATH_SEARCH_PATHS = ( 312 | "$(inherited)", 313 | "@executable_path/Frameworks", 314 | ); 315 | OTHER_LDFLAGS = ( 316 | "$(inherited)", 317 | "-framework", 318 | composeApp, 319 | ); 320 | PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; 321 | PRODUCT_NAME = "${APP_NAME}"; 322 | PROVISIONING_PROFILE_SPECIFIER = ""; 323 | SWIFT_VERSION = 5.0; 324 | TARGETED_DEVICE_FAMILY = "1,2"; 325 | }; 326 | name = Debug; 327 | }; 328 | 7555FFA7242A565B00829871 /* Release */ = { 329 | isa = XCBuildConfiguration; 330 | buildSettings = { 331 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 332 | CODE_SIGN_IDENTITY = "Apple Development"; 333 | CODE_SIGN_STYLE = Automatic; 334 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; 335 | DEVELOPMENT_TEAM = "${TEAM_ID}"; 336 | ENABLE_PREVIEWS = YES; 337 | FRAMEWORK_SEARCH_PATHS = ( 338 | "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)", 339 | ); 340 | INFOPLIST_FILE = iosApp/Info.plist; 341 | IPHONEOS_DEPLOYMENT_TARGET = 14.1; 342 | LD_RUNPATH_SEARCH_PATHS = ( 343 | "$(inherited)", 344 | "@executable_path/Frameworks", 345 | ); 346 | OTHER_LDFLAGS = ( 347 | "$(inherited)", 348 | "-framework", 349 | composeApp, 350 | ); 351 | PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; 352 | PRODUCT_NAME = "${APP_NAME}"; 353 | PROVISIONING_PROFILE_SPECIFIER = ""; 354 | SWIFT_VERSION = 5.0; 355 | TARGETED_DEVICE_FAMILY = "1,2"; 356 | }; 357 | name = Release; 358 | }; 359 | /* End XCBuildConfiguration section */ 360 | 361 | /* Begin XCConfigurationList section */ 362 | 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { 363 | isa = XCConfigurationList; 364 | buildConfigurations = ( 365 | 7555FFA3242A565B00829871 /* Debug */, 366 | 7555FFA4242A565B00829871 /* Release */, 367 | ); 368 | defaultConfigurationIsVisible = 0; 369 | defaultConfigurationName = Release; 370 | }; 371 | 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { 372 | isa = XCConfigurationList; 373 | buildConfigurations = ( 374 | 7555FFA6242A565B00829871 /* Debug */, 375 | 7555FFA7242A565B00829871 /* Release */, 376 | ); 377 | defaultConfigurationIsVisible = 0; 378 | defaultConfigurationName = Release; 379 | }; 380 | /* End XCConfigurationList section */ 381 | }; 382 | rootObject = 7555FF73242A565900829871 /* Project object */; 383 | } 384 | --------------------------------------------------------------------------------