├── shared ├── src │ ├── commonMain │ │ ├── resources │ │ │ ├── MR │ │ │ │ ├── files │ │ │ │ │ └── some_file.txt │ │ │ │ ├── assets │ │ │ │ │ └── some_asset.txt │ │ │ │ ├── ru │ │ │ │ │ ├── strings.xml │ │ │ │ │ └── plurals.xml │ │ │ │ ├── base │ │ │ │ │ ├── strings.xml │ │ │ │ │ └── plurals.xml │ │ │ │ ├── images │ │ │ │ │ ├── moko_logo@1x.png │ │ │ │ │ ├── moko_logo@2x.png │ │ │ │ │ └── moko_logo@3x.png │ │ │ │ ├── fonts │ │ │ │ │ └── cormorant-italic.otf │ │ │ │ └── colors │ │ │ │ │ └── colors.xml │ │ │ └── compose-multiplatform.xml │ │ └── kotlin │ │ │ ├── Route.kt │ │ │ ├── NavigationScreen.kt │ │ │ ├── App.kt │ │ │ ├── WelcomeScreen.kt │ │ │ ├── ViewModelScreen.kt │ │ │ ├── PermissionsScreen.kt │ │ │ ├── BiometryScreen.kt │ │ │ ├── GeoScreen.kt │ │ │ ├── MediaScreen.kt │ │ │ └── ResourcesScreen.kt │ ├── androidMain │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ │ └── main.android.kt │ └── iosMain │ │ └── kotlin │ │ └── main.ios.kt └── build.gradle.kts ├── iosApp ├── Configuration │ └── Config.xcconfig ├── Podfile ├── 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 └── iosApp.xcodeproj │ └── project.pbxproj ├── androidApp ├── src │ └── androidMain │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ └── ic_launcher_background.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_round.webp │ │ │ └── ic_launcher_foreground.webp │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_round.webp │ │ │ └── ic_launcher_foreground.webp │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_round.webp │ │ │ └── ic_launcher_foreground.webp │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_round.webp │ │ │ └── ic_launcher_foreground.webp │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_round.webp │ │ │ └── ic_launcher_foreground.webp │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ └── drawable │ │ │ └── ic_launcher_background.xml │ │ ├── ic_launcher-playstore.png │ │ ├── kotlin │ │ └── com │ │ │ └── myapplication │ │ │ └── MainActivity.kt │ │ └── AndroidManifest.xml └── build.gradle.kts ├── readme_images ├── banner.png ├── run_on_android.png ├── target_device.png ├── edit_run_config.png ├── hello_world_ios.png ├── text_field_added.png ├── android_app_running.png └── open_project_view.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── cleanup.sh ├── .gitignore ├── gradle.properties ├── settings.gradle.kts ├── gradlew.bat ├── gradlew ├── LICENSE.txt └── README.md /shared/src/commonMain/resources/MR/files/some_file.txt: -------------------------------------------------------------------------------- 1 | Text from file resource. -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/assets/some_asset.txt: -------------------------------------------------------------------------------- 1 | Text from asset resource. -------------------------------------------------------------------------------- /shared/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /iosApp/Configuration/Config.xcconfig: -------------------------------------------------------------------------------- 1 | TEAM_ID= 2 | BUNDLE_ID=com.myapplication.MyApplication 3 | APP_NAME=My application 4 | -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | My application 3 | -------------------------------------------------------------------------------- /iosApp/Podfile: -------------------------------------------------------------------------------- 1 | target 'iosApp' do 2 | use_frameworks! 3 | platform :ios, '14.1' 4 | pod 'shared', :path => '../shared' 5 | end -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /readme_images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/readme_images/banner.png -------------------------------------------------------------------------------- /iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } -------------------------------------------------------------------------------- /readme_images/run_on_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/readme_images/run_on_android.png -------------------------------------------------------------------------------- /readme_images/target_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/readme_images/target_device.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /readme_images/edit_run_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/readme_images/edit_run_config.png -------------------------------------------------------------------------------- /readme_images/hello_world_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/readme_images/hello_world_ios.png -------------------------------------------------------------------------------- /readme_images/text_field_added.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/readme_images/text_field_added.png -------------------------------------------------------------------------------- /readme_images/android_app_running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/readme_images/android_app_running.png -------------------------------------------------------------------------------- /readme_images/open_project_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/readme_images/open_project_view.png -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /androidApp/src/androidMain/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/ic_launcher-playstore.png -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #4285F4 4 | -------------------------------------------------------------------------------- /shared/src/androidMain/kotlin/main.android.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.runtime.Composable 2 | 3 | actual fun getPlatformName(): String = "Android" 4 | 5 | @Composable fun MainView() = App() 6 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/Route.kt: -------------------------------------------------------------------------------- 1 | enum class Route { 2 | Welcome, 3 | Resources, 4 | ViewModel, 5 | Permissions, 6 | Media, 7 | Biometry, 8 | Geo 9 | } 10 | -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/ru/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Привет Мир moko-resources 4 | 5 | -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/base/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello moko-resources World 4 | 5 | -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/images/moko_logo@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/shared/src/commonMain/resources/MR/images/moko_logo@1x.png -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/images/moko_logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/shared/src/commonMain/resources/MR/images/moko_logo@2x.png -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/images/moko_logo@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/shared/src/commonMain/resources/MR/images/moko_logo@3x.png -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/fonts/cormorant-italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/shared/src/commonMain/resources/MR/fonts/cormorant-italic.otf -------------------------------------------------------------------------------- /shared/src/iosMain/kotlin/main.ios.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.ui.window.ComposeUIViewController 2 | 3 | actual fun getPlatformName(): String = "iOS" 4 | 5 | fun MainViewController() = ComposeUIViewController { App() } -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-compose-multiplatform-ios-android-template/HEAD/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/colors/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0x1B5E20FF 5 | 0x81C784FF 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm -rf .idea 3 | ./gradlew clean 4 | rm -rf .gradle 5 | rm -rf build 6 | rm -rf */build 7 | rm -rf iosApp/iosApp.xcworkspace 8 | rm -rf iosApp/Pods 9 | rm -rf iosApp/iosApp.xcodeproj/project.xcworkspace 10 | rm -rf iosApp/iosApp.xcodeproj/xcuserdata 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | build/ 7 | /captures 8 | .externalNativeBuild 9 | .cxx 10 | iosApp/Podfile.lock 11 | iosApp/Pods/* 12 | iosApp/iosApp.xcworkspace/* 13 | iosApp/iosApp.xcodeproj/* 14 | !iosApp/iosApp.xcodeproj/project.pbxproj 15 | shared/shared.podspec 16 | -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.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 | -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/base/plurals.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zero chars 5 | %d char 6 | %d chars 7 | %d chars 8 | 9 | -------------------------------------------------------------------------------- /shared/src/commonMain/resources/MR/ru/plurals.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d символов 5 | %d символ 6 | %d символа 7 | %d символов 8 | %d символа 9 | 10 | 11 | -------------------------------------------------------------------------------- /androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.myapplication 2 | 3 | import MainView 4 | import android.os.Bundle 5 | import androidx.activity.compose.setContent 6 | import androidx.appcompat.app.AppCompatActivity 7 | 8 | class MainActivity : AppCompatActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | 12 | setContent { 13 | MainView() 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /iosApp/iosApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SwiftUI 3 | import shared 4 | 5 | struct ComposeView: UIViewControllerRepresentable { 6 | func makeUIViewController(context: Context) -> UIViewController { 7 | Main_iosKt.MainViewController() 8 | } 9 | 10 | func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} 11 | } 12 | 13 | struct ContentView: View { 14 | var body: some View { 15 | ComposeView() 16 | .ignoresSafeArea(.keyboard) // Compose has own keyboard handler 17 | } 18 | } 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | #Gradle 2 | org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" 3 | 4 | #Kotlin 5 | kotlin.code.style=official 6 | 7 | #MPP 8 | kotlin.mpp.stability.nowarn=true 9 | kotlin.mpp.enableCInteropCommonization=true 10 | kotlin.mpp.androidSourceSetLayoutVersion=2 11 | 12 | #Compose 13 | org.jetbrains.compose.experimental.uikit.enabled=true 14 | kotlin.native.cacheKind=none 15 | 16 | #Android 17 | android.useAndroidX=true 18 | android.compileSdk=33 19 | android.targetSdk=32 20 | android.minSdk=24 21 | 22 | #Versions 23 | kotlin.version=1.8.20 24 | agp.version=7.4.2 25 | compose.version=1.4.0 26 | moko.resources.version=0.22.2 27 | moko.mvvm.version = 0.16.0 28 | moko.permissions.version = 0.15.0 29 | moko.media.version = 0.11.0 30 | moko.biometry.version = 0.3.0 31 | moko.geo.version = 0.6.0 32 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/NavigationScreen.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.foundation.layout.PaddingValues 2 | import androidx.compose.material.Icon 3 | import androidx.compose.material.IconButton 4 | import androidx.compose.material.Scaffold 5 | import androidx.compose.material.Text 6 | import androidx.compose.material.TopAppBar 7 | import androidx.compose.material.icons.Icons 8 | import androidx.compose.material.icons.filled.ArrowBack 9 | import androidx.compose.runtime.Composable 10 | 11 | @Composable 12 | fun NavigationScreen( 13 | title: String, 14 | backAction: () -> Unit, 15 | body: @Composable (PaddingValues) -> Unit 16 | ) { 17 | Scaffold( 18 | topBar = { 19 | TopAppBar( 20 | title = { Text(text = title) }, 21 | navigationIcon = { 22 | IconButton(onClick = backAction) { 23 | Icon(imageVector = Icons.Default.ArrowBack, contentDescription = null) 24 | } 25 | } 26 | ) 27 | }, 28 | content = body 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /androidApp/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.android.application") 4 | id("org.jetbrains.compose") 5 | } 6 | 7 | kotlin { 8 | android() 9 | sourceSets { 10 | val androidMain by getting { 11 | dependencies { 12 | implementation(project(":shared")) 13 | } 14 | } 15 | } 16 | } 17 | 18 | android { 19 | compileSdk = (findProperty("android.compileSdk") as String).toInt() 20 | namespace = "com.myapplication" 21 | 22 | sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") 23 | 24 | defaultConfig { 25 | applicationId = "com.myapplication.MyApplication" 26 | minSdk = (findProperty("android.minSdk") as String).toInt() 27 | targetSdk = (findProperty("android.targetSdk") as String).toInt() 28 | versionCode = 1 29 | versionName = "1.0" 30 | } 31 | compileOptions { 32 | sourceCompatibility = JavaVersion.VERSION_11 33 | targetCompatibility = JavaVersion.VERSION_11 34 | } 35 | kotlin { 36 | jvmToolchain(11) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /androidApp/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "MyApplication" 2 | 3 | include(":androidApp") 4 | include(":shared") 5 | 6 | pluginManagement { 7 | repositories { 8 | gradlePluginPortal() 9 | maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 10 | google() 11 | } 12 | 13 | plugins { 14 | val kotlinVersion = extra["kotlin.version"] as String 15 | val agpVersion = extra["agp.version"] as String 16 | val composeVersion = extra["compose.version"] as String 17 | val mokoResourcesVersion = extra["moko.resources.version"] as String 18 | 19 | kotlin("jvm").version(kotlinVersion) 20 | kotlin("multiplatform").version(kotlinVersion) 21 | kotlin("android").version(kotlinVersion) 22 | 23 | id("com.android.application").version(agpVersion) 24 | id("com.android.library").version(agpVersion) 25 | 26 | id("org.jetbrains.compose").version(composeVersion) 27 | 28 | id("dev.icerock.mobile.multiplatform-resources").version(mokoResourcesVersion) 29 | } 30 | } 31 | 32 | dependencyResolutionManagement { 33 | repositories { 34 | google() 35 | mavenCentral() 36 | maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 37 | 38 | maven { url = uri("https://jitpack.io") } // for moko-media android picker 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/App.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.material.MaterialTheme 2 | import androidx.compose.runtime.Composable 3 | import androidx.compose.runtime.getValue 4 | import androidx.compose.runtime.mutableStateOf 5 | import androidx.compose.runtime.saveable.rememberSaveable 6 | import androidx.compose.runtime.setValue 7 | 8 | @Composable 9 | fun App() { 10 | var currentScreen: Route by rememberSaveable { mutableStateOf(Route.Welcome) } 11 | 12 | MaterialTheme { 13 | when (currentScreen) { 14 | Route.Welcome -> WelcomeScreen( 15 | route = { currentScreen = it } 16 | ) 17 | 18 | Route.Resources -> ResourcesScreen( 19 | backAction = { currentScreen = Route.Welcome } 20 | ) 21 | 22 | Route.ViewModel -> ViewModelScreen( 23 | backAction = { currentScreen = Route.Welcome } 24 | ) 25 | 26 | Route.Permissions -> PermissionsScreen( 27 | backAction = { currentScreen = Route.Welcome } 28 | ) 29 | 30 | Route.Media -> MediaScreen( 31 | backAction = { currentScreen = Route.Welcome } 32 | ) 33 | 34 | Route.Biometry -> BiometryScreen( 35 | backAction = { currentScreen = Route.Welcome } 36 | ) 37 | 38 | Route.Geo -> GeoScreen( 39 | backAction = { currentScreen = Route.Welcome } 40 | ) 41 | } 42 | } 43 | } 44 | 45 | expect fun getPlatformName(): String 46 | -------------------------------------------------------------------------------- /androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/WelcomeScreen.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.foundation.Image 2 | import androidx.compose.foundation.background 3 | import androidx.compose.foundation.layout.Column 4 | import androidx.compose.foundation.layout.fillMaxSize 5 | import androidx.compose.foundation.layout.padding 6 | import androidx.compose.material.Button 7 | import androidx.compose.material.MaterialTheme 8 | import androidx.compose.material.Text 9 | import androidx.compose.runtime.Composable 10 | import androidx.compose.ui.Alignment 11 | import androidx.compose.ui.Modifier 12 | import androidx.compose.ui.unit.dp 13 | import com.myapplication.common.MR 14 | import dev.icerock.moko.resources.compose.painterResource 15 | 16 | @Composable 17 | fun WelcomeScreen(route: (Route) -> Unit) { 18 | Column( 19 | modifier = Modifier.fillMaxSize() 20 | .background(color = MaterialTheme.colors.background) 21 | .padding(16.dp), 22 | horizontalAlignment = Alignment.CenterHorizontally 23 | ) { 24 | Image( 25 | painter = painterResource(MR.images.moko_logo), 26 | contentDescription = null 27 | ) 28 | 29 | Button(onClick = { route(Route.Resources) }) { 30 | Text(text = "moko-resources") 31 | } 32 | 33 | Button(onClick = { route(Route.ViewModel) }) { 34 | Text(text = "moko-mvvm") 35 | } 36 | 37 | Button(onClick = { route(Route.Permissions) }) { 38 | Text(text = "moko-permissions") 39 | } 40 | 41 | Button(onClick = { route(Route.Media) }) { 42 | Text(text = "moko-media") 43 | } 44 | 45 | Button(onClick = { route(Route.Biometry) }) { 46 | Text(text = "moko-biometry") 47 | } 48 | 49 | Button(onClick = { route(Route.Geo) }) { 50 | Text(text = "moko-geo") 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /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 | NSLocationWhenInUseUsageDescription 51 | moko-permissions demo usage 52 | 53 | 54 | NSPhotoLibraryUsageDescription 55 | moko-media demo usage 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/ViewModelScreen.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.foundation.layout.Column 2 | import androidx.compose.foundation.layout.Spacer 3 | import androidx.compose.foundation.layout.fillMaxSize 4 | import androidx.compose.foundation.layout.height 5 | import androidx.compose.foundation.layout.padding 6 | import androidx.compose.material.Button 7 | import androidx.compose.material.Text 8 | import androidx.compose.runtime.Composable 9 | import androidx.compose.runtime.collectAsState 10 | import androidx.compose.runtime.getValue 11 | import androidx.compose.ui.Alignment 12 | import androidx.compose.ui.Modifier 13 | import androidx.compose.ui.unit.dp 14 | import dev.icerock.moko.mvvm.compose.getViewModel 15 | import dev.icerock.moko.mvvm.compose.viewModelFactory 16 | import dev.icerock.moko.mvvm.viewmodel.ViewModel 17 | import kotlinx.coroutines.flow.MutableStateFlow 18 | import kotlinx.coroutines.flow.StateFlow 19 | import kotlinx.coroutines.flow.update 20 | 21 | @Composable 22 | fun ViewModelScreen( 23 | backAction: () -> Unit, 24 | viewModel: SimpleViewModel = getViewModel( 25 | key = "simple-screen", 26 | factory = viewModelFactory { SimpleViewModel() } 27 | ) 28 | ) = NavigationScreen(title = "moko-mvvm", backAction = backAction) { paddingValues -> 29 | val count: Int by viewModel.count.collectAsState() 30 | 31 | Column( 32 | modifier = Modifier.fillMaxSize().padding(paddingValues), 33 | horizontalAlignment = Alignment.CenterHorizontally 34 | ) { 35 | Text(text = count.toString()) 36 | 37 | Spacer(modifier = Modifier.height(8.dp)) 38 | 39 | Button(onClick = viewModel::onCountClick) { 40 | Text(text = "Click on me") 41 | } 42 | } 43 | } 44 | 45 | class SimpleViewModel : ViewModel() { 46 | private val _count: MutableStateFlow = MutableStateFlow(0) 47 | val count: StateFlow get() = _count 48 | 49 | init { 50 | println("view model $this created!") 51 | } 52 | 53 | fun onCountClick() { 54 | _count.update { it + 1 } 55 | } 56 | 57 | override fun onCleared() { 58 | super.onCleared() 59 | 60 | println("view model $this cleared!") 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /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 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if %ERRORLEVEL% equ 0 goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if %ERRORLEVEL% equ 0 goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | set EXIT_CODE=%ERRORLEVEL% 84 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 85 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 86 | exit /b %EXIT_CODE% 87 | 88 | :mainEnd 89 | if "%OS%"=="Windows_NT" endlocal 90 | 91 | :omega 92 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/PermissionsScreen.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.foundation.layout.Column 2 | import androidx.compose.foundation.layout.fillMaxSize 3 | import androidx.compose.foundation.layout.padding 4 | import androidx.compose.material.Button 5 | import androidx.compose.material.Text 6 | import androidx.compose.runtime.Composable 7 | import androidx.compose.runtime.collectAsState 8 | import androidx.compose.runtime.getValue 9 | import androidx.compose.ui.Alignment 10 | import androidx.compose.ui.Modifier 11 | import dev.icerock.moko.mvvm.compose.getViewModel 12 | import dev.icerock.moko.mvvm.compose.viewModelFactory 13 | import dev.icerock.moko.mvvm.viewmodel.ViewModel 14 | import dev.icerock.moko.permissions.DeniedException 15 | import dev.icerock.moko.permissions.Permission 16 | import dev.icerock.moko.permissions.PermissionsController 17 | import dev.icerock.moko.permissions.RequestCanceledException 18 | import dev.icerock.moko.permissions.compose.BindEffect 19 | import dev.icerock.moko.permissions.compose.PermissionsControllerFactory 20 | import dev.icerock.moko.permissions.compose.rememberPermissionsControllerFactory 21 | import kotlinx.coroutines.flow.MutableStateFlow 22 | import kotlinx.coroutines.flow.StateFlow 23 | import kotlinx.coroutines.launch 24 | 25 | @Composable 26 | internal fun PermissionsScreen( 27 | backAction: () -> Unit 28 | ) { 29 | val permissionsControllerFactory: PermissionsControllerFactory = 30 | rememberPermissionsControllerFactory() 31 | 32 | PermissionsScreen( 33 | backAction = backAction, 34 | viewModel = getViewModel( 35 | key = "permissions-screen", 36 | factory = viewModelFactory { 37 | PermissionsViewModel(permissionsControllerFactory.createPermissionsController()) 38 | } 39 | ) 40 | ) 41 | } 42 | 43 | @Composable 44 | private fun PermissionsScreen( 45 | backAction: () -> Unit, 46 | viewModel: PermissionsViewModel 47 | ) = NavigationScreen(title = "moko-permissions", backAction = backAction) { paddingValues -> 48 | BindEffect(viewModel.permissionsController) 49 | 50 | val state: String by viewModel.state.collectAsState() 51 | 52 | Column( 53 | modifier = Modifier.fillMaxSize().padding(paddingValues), 54 | horizontalAlignment = Alignment.CenterHorizontally 55 | ) { 56 | Text(text = state) 57 | 58 | Button(onClick = viewModel::onButtonClick) { 59 | Text(text = "Click on me") 60 | } 61 | } 62 | } 63 | 64 | internal class PermissionsViewModel( 65 | val permissionsController: PermissionsController 66 | ) : ViewModel() { 67 | private val _state: MutableStateFlow = MutableStateFlow("press button") 68 | val state: StateFlow get() = _state 69 | 70 | fun onButtonClick() { 71 | viewModelScope.launch { 72 | try { 73 | permissionsController.providePermission(Permission.LOCATION) 74 | 75 | _state.value = "permission granted" 76 | } catch (exc: RequestCanceledException) { 77 | _state.value = "permission cancelled $exc" 78 | } catch (exc: DeniedException) { 79 | _state.value = "permission denied $exc" 80 | } 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/BiometryScreen.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.foundation.layout.Column 2 | import androidx.compose.foundation.layout.fillMaxSize 3 | import androidx.compose.foundation.layout.padding 4 | import androidx.compose.material.Button 5 | import androidx.compose.material.Text 6 | import androidx.compose.runtime.Composable 7 | import androidx.compose.runtime.collectAsState 8 | import androidx.compose.runtime.getValue 9 | import androidx.compose.ui.Alignment 10 | import androidx.compose.ui.Modifier 11 | import dev.icerock.moko.biometry.BiometryAuthenticator 12 | import dev.icerock.moko.biometry.compose.BindBiometryAuthenticatorEffect 13 | import dev.icerock.moko.biometry.compose.BiometryAuthenticatorFactory 14 | import dev.icerock.moko.biometry.compose.rememberBiometryAuthenticatorFactory 15 | import dev.icerock.moko.mvvm.compose.getViewModel 16 | import dev.icerock.moko.mvvm.compose.viewModelFactory 17 | import dev.icerock.moko.mvvm.viewmodel.ViewModel 18 | import dev.icerock.moko.resources.desc.desc 19 | import kotlinx.coroutines.flow.MutableStateFlow 20 | import kotlinx.coroutines.flow.StateFlow 21 | import kotlinx.coroutines.launch 22 | 23 | @Composable 24 | internal fun BiometryScreen( 25 | backAction: () -> Unit 26 | ) { 27 | val biometryAuthenticatorFactory: BiometryAuthenticatorFactory = 28 | rememberBiometryAuthenticatorFactory() 29 | 30 | BiometryScreen( 31 | backAction = backAction, 32 | viewModel = getViewModel( 33 | key = "biometry-screen", 34 | factory = viewModelFactory { 35 | BiometryViewModel( 36 | biometryAuthenticator = biometryAuthenticatorFactory.createBiometryAuthenticator() 37 | ) 38 | } 39 | ) 40 | ) 41 | } 42 | 43 | @Composable 44 | private fun BiometryScreen( 45 | backAction: () -> Unit, 46 | viewModel: BiometryViewModel 47 | ) = NavigationScreen(title = "moko-biometry", backAction = backAction) { paddingValues -> 48 | BindBiometryAuthenticatorEffect(viewModel.biometryAuthenticator) 49 | 50 | val text: String by viewModel.result.collectAsState() 51 | 52 | Column( 53 | modifier = Modifier.fillMaxSize().padding(paddingValues), 54 | horizontalAlignment = Alignment.CenterHorizontally 55 | ) { 56 | Text(text = text) 57 | 58 | Button(onClick = viewModel::onButtonClick) { 59 | Text(text = "Click on me") 60 | } 61 | } 62 | } 63 | 64 | internal class BiometryViewModel( 65 | val biometryAuthenticator: BiometryAuthenticator 66 | ) : ViewModel() { 67 | private val _result: MutableStateFlow = MutableStateFlow("press button") 68 | val result: StateFlow get() = _result 69 | 70 | fun onButtonClick() { 71 | viewModelScope.launch { 72 | try { 73 | biometryAuthenticator.checkBiometryAuthentication( 74 | requestTitle = "Biometry".desc(), 75 | requestReason = "Just for demo".desc(), 76 | failureButtonText = "Cancel".desc() 77 | ) 78 | 79 | _result.value = "biometry check success" 80 | } catch (exc: Exception) { 81 | _result.value = exc.toString() 82 | } 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/GeoScreen.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.foundation.layout.Column 2 | import androidx.compose.foundation.layout.fillMaxSize 3 | import androidx.compose.foundation.layout.padding 4 | import androidx.compose.material.Button 5 | import androidx.compose.material.Text 6 | import androidx.compose.runtime.Composable 7 | import androidx.compose.runtime.collectAsState 8 | import androidx.compose.runtime.getValue 9 | import androidx.compose.ui.Alignment 10 | import androidx.compose.ui.Modifier 11 | import dev.icerock.moko.geo.LocationTracker 12 | import dev.icerock.moko.geo.compose.BindLocationTrackerEffect 13 | import dev.icerock.moko.geo.compose.LocationTrackerAccuracy 14 | import dev.icerock.moko.geo.compose.LocationTrackerFactory 15 | import dev.icerock.moko.geo.compose.rememberLocationTrackerFactory 16 | import dev.icerock.moko.mvvm.compose.getViewModel 17 | import dev.icerock.moko.mvvm.compose.viewModelFactory 18 | import dev.icerock.moko.mvvm.viewmodel.ViewModel 19 | import kotlinx.coroutines.flow.MutableStateFlow 20 | import kotlinx.coroutines.flow.StateFlow 21 | import kotlinx.coroutines.flow.launchIn 22 | import kotlinx.coroutines.flow.onEach 23 | import kotlinx.coroutines.launch 24 | 25 | @Composable 26 | internal fun GeoScreen( 27 | backAction: () -> Unit 28 | ) { 29 | val locationTrackerFactory: LocationTrackerFactory = rememberLocationTrackerFactory( 30 | accuracy = LocationTrackerAccuracy.Best 31 | ) 32 | 33 | GeoScreen( 34 | backAction = backAction, 35 | viewModel = getViewModel( 36 | key = "geo-screen", 37 | factory = viewModelFactory { 38 | GeoViewModel( 39 | locationTracker = locationTrackerFactory.createLocationTracker() 40 | ) 41 | } 42 | ) 43 | ) 44 | } 45 | 46 | @Composable 47 | private fun GeoScreen( 48 | backAction: () -> Unit, 49 | viewModel: GeoViewModel 50 | ) = NavigationScreen(title = "moko-geo", backAction = backAction) { paddingValues -> 51 | BindLocationTrackerEffect(viewModel.locationTracker) 52 | 53 | val text: String by viewModel.result.collectAsState() 54 | 55 | Column( 56 | modifier = Modifier.fillMaxSize().padding(paddingValues), 57 | horizontalAlignment = Alignment.CenterHorizontally 58 | ) { 59 | Text(text = text) 60 | 61 | Button(onClick = viewModel::onStartClick) { 62 | Text(text = "Start") 63 | } 64 | 65 | Button(onClick = viewModel::onStopClick) { 66 | Text(text = "Stop") 67 | } 68 | } 69 | } 70 | 71 | internal class GeoViewModel( 72 | val locationTracker: LocationTracker 73 | ) : ViewModel() { 74 | private val _result: MutableStateFlow = MutableStateFlow("press button") 75 | val result: StateFlow get() = _result 76 | 77 | init { 78 | locationTracker.getLocationsFlow() 79 | .onEach { _result.value = it.toString() } 80 | .launchIn(viewModelScope) 81 | } 82 | 83 | fun onStartClick() { 84 | viewModelScope.launch { 85 | try { 86 | locationTracker.startTracking() 87 | } catch (exc: Exception) { 88 | _result.value = exc.toString() 89 | } 90 | } 91 | } 92 | 93 | fun onStopClick() { 94 | locationTracker.stopTracking() 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/MediaScreen.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.foundation.Image 2 | import androidx.compose.foundation.layout.Column 3 | import androidx.compose.foundation.layout.fillMaxSize 4 | import androidx.compose.foundation.layout.padding 5 | import androidx.compose.material.Button 6 | import androidx.compose.material.Text 7 | import androidx.compose.runtime.Composable 8 | import androidx.compose.runtime.collectAsState 9 | import androidx.compose.runtime.getValue 10 | import androidx.compose.runtime.remember 11 | import androidx.compose.ui.Alignment 12 | import androidx.compose.ui.Modifier 13 | import androidx.compose.ui.graphics.ImageBitmap 14 | import dev.icerock.moko.media.Bitmap 15 | import dev.icerock.moko.media.compose.BindMediaPickerEffect 16 | import dev.icerock.moko.media.compose.MediaPickerControllerFactory 17 | import dev.icerock.moko.media.compose.rememberMediaPickerControllerFactory 18 | import dev.icerock.moko.media.compose.toImageBitmap 19 | import dev.icerock.moko.media.picker.MediaPickerController 20 | import dev.icerock.moko.media.picker.MediaSource 21 | import dev.icerock.moko.mvvm.compose.getViewModel 22 | import dev.icerock.moko.mvvm.compose.viewModelFactory 23 | import dev.icerock.moko.mvvm.viewmodel.ViewModel 24 | import kotlinx.coroutines.flow.MutableStateFlow 25 | import kotlinx.coroutines.flow.StateFlow 26 | import kotlinx.coroutines.launch 27 | 28 | @Composable 29 | internal fun MediaScreen( 30 | backAction: () -> Unit 31 | ) { 32 | val mediaPickerControllerFactory: MediaPickerControllerFactory = 33 | rememberMediaPickerControllerFactory() 34 | 35 | MediaScreen( 36 | backAction = backAction, 37 | viewModel = getViewModel( 38 | key = "media-screen", 39 | factory = viewModelFactory { 40 | MediaViewModel( 41 | mediaPickerController = mediaPickerControllerFactory.createMediaPickerController() 42 | ) 43 | } 44 | ) 45 | ) 46 | } 47 | 48 | @Composable 49 | private fun MediaScreen( 50 | backAction: () -> Unit, 51 | viewModel: MediaViewModel 52 | ) = NavigationScreen(title = "moko-media", backAction = backAction) { paddingValues -> 53 | BindMediaPickerEffect(viewModel.mediaPickerController) 54 | 55 | val image: Bitmap? by viewModel.image.collectAsState() 56 | val imageBitmap: ImageBitmap? = remember(image) { image?.toImageBitmap() } 57 | 58 | Column( 59 | modifier = Modifier.fillMaxSize().padding(paddingValues), 60 | horizontalAlignment = Alignment.CenterHorizontally 61 | ) { 62 | if (imageBitmap != null) { 63 | Image(bitmap = imageBitmap, contentDescription = null) 64 | } 65 | 66 | Button(onClick = viewModel::onButtonClick) { 67 | Text(text = "Click on me") 68 | } 69 | } 70 | } 71 | 72 | internal class MediaViewModel( 73 | val mediaPickerController: MediaPickerController 74 | ) : ViewModel() { 75 | private val _image: MutableStateFlow = MutableStateFlow(null) 76 | val image: StateFlow get() = _image 77 | 78 | fun onButtonClick() { 79 | viewModelScope.launch { 80 | try { 81 | _image.value = mediaPickerController.pickImage(MediaSource.GALLERY) 82 | } catch (exc: Exception) { 83 | println("error $exc") 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/ResourcesScreen.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.foundation.Image 2 | import androidx.compose.foundation.layout.Column 3 | import androidx.compose.foundation.layout.fillMaxSize 4 | import androidx.compose.foundation.layout.fillMaxWidth 5 | import androidx.compose.foundation.layout.padding 6 | import androidx.compose.material.Button 7 | import androidx.compose.material.MaterialTheme 8 | import androidx.compose.material.OutlinedTextField 9 | import androidx.compose.material.Text 10 | import androidx.compose.material.TextFieldDefaults 11 | import androidx.compose.runtime.Composable 12 | import androidx.compose.runtime.getValue 13 | import androidx.compose.runtime.mutableStateOf 14 | import androidx.compose.runtime.remember 15 | import androidx.compose.runtime.setValue 16 | import androidx.compose.ui.Alignment 17 | import androidx.compose.ui.Modifier 18 | import androidx.compose.ui.unit.dp 19 | import com.myapplication.common.MR 20 | import dev.icerock.moko.resources.compose.colorResource 21 | import dev.icerock.moko.resources.compose.fontFamilyResource 22 | import dev.icerock.moko.resources.compose.painterResource 23 | import dev.icerock.moko.resources.compose.readTextAsState 24 | import dev.icerock.moko.resources.compose.stringResource 25 | import org.jetbrains.compose.resources.ExperimentalResourceApi 26 | import org.jetbrains.compose.resources.painterResource as composePainterResource 27 | 28 | @OptIn(ExperimentalResourceApi::class) 29 | @Composable 30 | fun ResourcesScreen( 31 | backAction: () -> Unit 32 | ) = NavigationScreen(title = "moko-resources", backAction = backAction) { paddingValues -> 33 | Column( 34 | modifier = Modifier.fillMaxSize().padding(paddingValues), 35 | horizontalAlignment = Alignment.CenterHorizontally 36 | ) { 37 | Image( 38 | painter = painterResource(MR.images.moko_logo), 39 | contentDescription = null 40 | ) 41 | 42 | var text: String by remember { mutableStateOf("") } 43 | 44 | OutlinedTextField( 45 | modifier = Modifier.fillMaxWidth() 46 | .padding(top = 16.dp), 47 | value = text, 48 | colors = TextFieldDefaults.outlinedTextFieldColors( 49 | textColor = MaterialTheme.colors.onBackground 50 | ), 51 | onValueChange = { text = it } 52 | ) 53 | 54 | val counter: Int = text.length 55 | Text( 56 | modifier = Modifier.fillMaxWidth() 57 | .padding(vertical = 8.dp), 58 | text = stringResource(MR.plurals.chars_count, counter, counter), 59 | color = colorResource(MR.colors.textColor), 60 | fontFamily = fontFamilyResource(MR.fonts.cormorant.italic) 61 | ) 62 | 63 | Button(onClick = { text = "Hello, ${getPlatformName()}" }) { 64 | Text(text = stringResource(MR.strings.hello_world)) 65 | } 66 | 67 | val fileContent: String? by MR.files.some_file.readTextAsState() 68 | Text( 69 | modifier = Modifier.padding(top = 16.dp), 70 | text = fileContent.orEmpty(), 71 | color = MaterialTheme.colors.onBackground 72 | ) 73 | 74 | val assetContent: String? by MR.assets.some_asset.readTextAsState() 75 | Text( 76 | modifier = Modifier.padding(top = 16.dp), 77 | text = assetContent.orEmpty(), 78 | color = MaterialTheme.colors.onBackground 79 | ) 80 | 81 | Image( 82 | painter = composePainterResource("compose-multiplatform.xml"), 83 | contentDescription = null 84 | ) 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /shared/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | kotlin("native.cocoapods") 4 | id("com.android.library") 5 | id("org.jetbrains.compose") 6 | id("dev.icerock.mobile.multiplatform-resources") 7 | } 8 | 9 | kotlin { 10 | android() 11 | 12 | iosX64() 13 | iosArm64() 14 | iosSimulatorArm64() 15 | 16 | cocoapods { 17 | version = "1.0.0" 18 | summary = "Some description for the Shared Module" 19 | homepage = "Link to the Shared Module homepage" 20 | ios.deploymentTarget = "14.1" 21 | podfile = project.file("../iosApp/Podfile") 22 | framework { 23 | baseName = "shared" 24 | isStatic = true 25 | } 26 | extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']" 27 | extraSpecAttributes["exclude_files"] = "['src/commonMain/resources/MR/**']" 28 | } 29 | 30 | sourceSets { 31 | val mokoResourcesVersion = extra["moko.resources.version"] as String 32 | val mokoMvvmVersion = extra["moko.mvvm.version"] as String 33 | val mokoPermissionsVersion = extra["moko.permissions.version"] as String 34 | val mokoMediaVersion = extra["moko.media.version"] as String 35 | val mokoBiometryVersion = extra["moko.biometry.version"] as String 36 | val mokoGeoVersion = extra["moko.geo.version"] as String 37 | 38 | val commonMain by getting { 39 | dependencies { 40 | implementation(compose.runtime) 41 | implementation(compose.foundation) 42 | implementation(compose.material) 43 | @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) 44 | implementation(compose.components.resources) 45 | 46 | implementation("dev.icerock.moko:resources-compose:$mokoResourcesVersion") 47 | 48 | implementation("dev.icerock.moko:mvvm-compose:$mokoMvvmVersion") 49 | 50 | implementation("dev.icerock.moko:permissions-compose:$mokoPermissionsVersion") 51 | 52 | implementation("dev.icerock.moko:media-compose:$mokoMediaVersion") 53 | 54 | implementation("dev.icerock.moko:biometry-compose:$mokoBiometryVersion") 55 | 56 | implementation("dev.icerock.moko:geo-compose:$mokoGeoVersion") 57 | 58 | // fix of Could not find "shared/build/kotlinTransformedMetadataLibraries/commonMain/org.jetbrains.kotlinx-atomicfu-0.17.3-nativeInterop-8G5yng.klib" 59 | implementation("org.jetbrains.kotlinx:atomicfu:0.17.3") 60 | } 61 | } 62 | val androidMain by getting { 63 | dependencies { 64 | api("androidx.activity:activity-compose:1.6.1") 65 | api("androidx.appcompat:appcompat:1.6.1") 66 | api("androidx.core:core-ktx:1.9.0") 67 | } 68 | } 69 | val iosX64Main by getting 70 | val iosArm64Main by getting 71 | val iosSimulatorArm64Main by getting 72 | val iosMain by creating { 73 | dependsOn(commonMain) 74 | iosX64Main.dependsOn(this) 75 | iosArm64Main.dependsOn(this) 76 | iosSimulatorArm64Main.dependsOn(this) 77 | } 78 | } 79 | } 80 | 81 | multiplatformResources { 82 | multiplatformResourcesPackage = "com.myapplication.common" 83 | } 84 | 85 | android { 86 | compileSdk = (findProperty("android.compileSdk") as String).toInt() 87 | namespace = "com.myapplication.common" 88 | 89 | sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") 90 | sourceSets["main"].res.srcDirs("src/androidMain/res") 91 | sourceSets["main"].resources.srcDirs("src/commonMain/resources") 92 | sourceSets["main"].resources.exclude("src/commonMain/resources/MR") 93 | 94 | defaultConfig { 95 | minSdk = (findProperty("android.minSdk") as String).toInt() 96 | targetSdk = (findProperty("android.targetSdk") as String).toInt() 97 | } 98 | compileOptions { 99 | sourceCompatibility = JavaVersion.VERSION_11 100 | targetCompatibility = JavaVersion.VERSION_11 101 | } 102 | kotlin { 103 | jvmToolchain(11) 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /shared/src/commonMain/resources/compose-multiplatform.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 18 | 24 | 30 | 36 | 37 | -------------------------------------------------------------------------------- /androidApp/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/master/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 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Stop when "xargs" is not available. 209 | if ! command -v xargs >/dev/null 2>&1 210 | then 211 | die "xargs is not available" 212 | fi 213 | 214 | # Use "xargs" to parse quoted args. 215 | # 216 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 217 | # 218 | # In Bash we could simply go: 219 | # 220 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 221 | # set -- "${ARGS[@]}" "$@" 222 | # 223 | # but POSIX shell has neither arrays nor command substitution, so instead we 224 | # post-process each arg (as a line of input to sed) to backslash-escape any 225 | # character that might be a shell metacharacter, then use eval to reverse 226 | # that process (while maintaining the separation between arguments), and wrap 227 | # the whole thing up as a single "set" statement. 228 | # 229 | # This will of course break if any of these variables contains a newline or 230 | # an unmatched quote. 231 | # 232 | 233 | eval "set -- $( 234 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 235 | xargs -n1 | 236 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 237 | tr '\n' ' ' 238 | )" '"$@"' 239 | 240 | exec "$JAVACMD" "$@" 241 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020-2021 JetBrains s.r.o. and and respective authors and developers. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![official project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) 2 | [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 3 | # [Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform) mobile application with [MOKO libraries](https://moko.icerock.dev) 4 | 5 | > **Note** 6 | > Compose Multiplatform for iOS is in Alpha. It may change incompatibly and require manual migration in the future. 7 | > We would appreciate your feedback on it in the public Slack channel [#compose-ios](https://kotlinlang.slack.com/archives/C0346LWVBJ4/p1678888063176359). 8 | > If you have any issues, please report them on [GitHub](https://github.com/JetBrains/compose-multiplatform/issues). 9 | 10 | You can use this template to start developing your own [Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform#readme) mobile application targeting Android and iOS. 11 | Follow our tutorial below to get your first Compose Multiplatform app up and running. 12 | The result will be a [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) project that uses the Compose Multiplatform UI framework. 13 | 14 | ![](readme_images/banner.png) 15 | 16 | Template have configured MOKO libraries: 17 | - [moko-resources](https://github.com/icerockdev/moko-resources) - use images, fonts and other resources 18 | - [moko-mvvm](https://github.com/icerockdev/moko-mvvm) - handle android configuration cache 19 | - [moko-permissions](https://github.com/icerockdev/moko-permissions) - request runtime permissions 20 | - [moko-media](https://github.com/icerockdev/moko-media) - pick photo from Gallery of Camera 21 | - [moko-biometry](https://github.com/icerockdev/moko-biometry) - call TouchID and FaceID 22 | - [moko-geo](https://github.com/icerockdev/moko-geo) - track geolocation 23 | 24 | ![moko-repo-header](https://user-images.githubusercontent.com/5010169/231642086-8f243134-2c72-4edc-95bb-12979f512c14.png) 25 | 26 |
27 | Check video demonstration of MOKO libraries with Compose Multiplatform 28 | 29 | https://user-images.githubusercontent.com/5010169/231541929-03d37bff-2aef-4fe3-a7da-fb559dad90c9.mp4 30 | 31 | https://user-images.githubusercontent.com/5010169/231541851-ead5cec2-93af-4e67-a3c2-8c0a446122a6.mp4 32 | 33 |
34 | 35 | If you want to create an application targeting desktop platforms – Windows, macOS, or Linux – 36 | use the [Compose Multiplatform desktop application template](https://github.com/JetBrains/compose-multiplatform-desktop-template#readme). 37 | 38 | ## Set up the environment 39 | 40 | > **Warning** 41 | > You need a Mac with macOS to write and run iOS-specific code on simulated or real devices. 42 | > This is an Apple requirement. 43 | 44 | To work with this template, you need the following: 45 | 46 | * A machine running a recent version of macOS 47 | * [Xcode](https://apps.apple.com/us/app/xcode/id497799835) 48 | * [Android Studio](https://developer.android.com/studio) 49 | * The [Kotlin Multiplatform Mobile plugin](https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile) 50 | * The [CocoaPods dependency manager](https://kotlinlang.org/docs/native-cocoapods.html) 51 | 52 | ### Check your environment 53 | 54 | Before you start, use the [KDoctor](https://github.com/Kotlin/kdoctor) tool to ensure that your development environment is configured correctly: 55 | 56 | 1. Install KDoctor with [Homebrew](https://brew.sh/): 57 | 58 | ```text 59 | brew install kdoctor 60 | ``` 61 | 62 | 2. Run KDoctor in your terminal: 63 | 64 | ```text 65 | kdoctor 66 | ``` 67 | 68 | If everything is set up correctly, you'll see valid output: 69 | 70 | ```text 71 | Environment diagnose (to see all details, use -v option): 72 | [✓] Operation System 73 | [✓] Java 74 | [✓] Android Studio 75 | [✓] Xcode 76 | [✓] Cocoapods 77 | 78 | Conclusion: 79 | ✓ Your system is ready for Kotlin Multiplatform Mobile development! 80 | ``` 81 | 82 | Otherwise, KDoctor will highlight which parts of your setup still need to be configured and will suggest a way to fix them. 83 | 84 | ## Examine the project structure 85 | 86 | Open the project in Android Studio and switch the view from **Android** to **Project** to see all the files and targets belonging to the project: 87 | 88 | 89 | 90 | Your Compose Multiplatform project includes 3 modules: 91 | 92 | ### shared 93 | 94 | This is a Kotlin module that contains the logic common for both Android and iOS applications, that is, the code you share between platforms. 95 | 96 | This `shared` module is also where you’ll write your Compose Multiplatform code. 97 | In `shared/src/commonMain/kotlin/App.kt`, you can find the shared root `@Composable` function for your app. 98 | 99 | It uses Gradle as the build system. You can add dependencies and change settings in `shared/build.gradle.kts`. 100 | The `shared` module builds into an Android library and an iOS framework. 101 | 102 | ### androidApp 103 | 104 | This is a Kotlin module that builds into an Android application. It uses Gradle as the build system. 105 | The `androidApp` module depends on and uses the `shared` module as a regular Android library. 106 | 107 | ### iosApp 108 | 109 | This is an Xcode project that builds into an iOS application. 110 | It depends on and uses the `shared` module as a CocoaPods dependency. 111 | 112 | ## Run your application 113 | 114 | ### On Android 115 | 116 | To run your application on an Android emulator: 117 | 118 | 1. Ensure you have an Android virtual device available. Otherwise, [create one](https://developer.android.com/studio/run/managing-avds#createavd). 119 | 2. In the list of run configurations, select `androidApp`. 120 | 3. Choose your virtual device and click **Run**: 121 | 122 | 123 | 124 | 125 | 126 |
127 | Alternatively, use Gradle 128 | 129 | To install an Android application on a real Android device or an emulator, run `./gradlew installDebug` in the terminal. 130 | 131 |
132 | 133 | ### On iOS 134 | 135 | #### Running on a simulator 136 | 137 | To run your application on an iOS simulator in Android Studio, modify the `iosApp` run configuration: 138 | 139 | 1. In the list of run configurations, select **Edit Configurations**: 140 | 141 | 142 | 143 | 2. Navigate to **iOS Application** | **iosApp**. 144 | 3. In the **Execution target** list, select your target device. Click **OK**: 145 | 146 | 147 | 148 | 4. The `iosApp` run configuration is now available. Click **Run** next to your virtual device: 149 | 150 | 151 | 152 | #### Running on a real device 153 | 154 | You can run your Compose Multiplatform application on a real iOS device for free. 155 | To do so, you'll need the following: 156 | 157 | * The `TEAM_ID` associated with your [Apple ID](https://support.apple.com/en-us/HT204316) 158 | * The iOS device registered in Xcode 159 | 160 | > **Note** 161 | > Before you continue, we suggest creating a simple "Hello, world!" project in Xcode to ensure you can successfully run apps on your device. 162 | > You can follow the instructions below or watch this [Stanford CS193P lecture recording](https://youtu.be/bqu6BquVi2M?start=716&end=1399). 163 | 164 |
165 | How to create and run a simple project in Xcode 166 | 167 | 1. On the Xcode welcome screen, select **Create a new project in Xcode**. 168 | 2. On the **iOS** tab, choose the **App** template. Click **Next**. 169 | 3. Specify the product name and keep other settings default. Click **Next**. 170 | 4. Select where to store the project on your computer and click **Create**. You'll see an app that displays "Hello, world!" on the device screen. 171 | 5. At the top of your Xcode screen, click on the device name near the **Run** button. 172 | 6. Plug your device into the computer. You'll see this device in the list of run options. 173 | 7. Choose your device and click **Run**. 174 | 175 |
176 | 177 | ##### Finding your Team ID 178 | 179 | In the terminal, run `kdoctor --team-ids` to find your Team ID. 180 | KDoctor will list all Team IDs currently configured on your system, for example: 181 | 182 | ```text 183 | 3ABC246XYZ (Max Sample) 184 | ZABCW6SXYZ (SampleTech Inc.) 185 | ``` 186 | 187 |
188 | Alternative way to find your Team ID 189 | 190 | If KDoctor doesn't work for you, try this alternative method: 191 | 192 | 1. In Android Studio, run the `iosApp` configuration with the selected real device. The build should fail. 193 | 2. Go to Xcode and select **Open a project or file**. 194 | 3. Navigate to the `iosApp/iosApp.xcworkspace` file of your project. 195 | 4. In the left-hand menu, select `iosApp`. 196 | 5. Navigate to **Signing & Capabilities**. 197 | 6. In the **Team** list, select your team. 198 | 199 | If you haven't set up your team yet, use the **Add account** option and follow the steps. 200 | 201 |
202 | 203 | To run the application, set the `TEAM_ID`: 204 | 205 | 1. In the template, navigate to the `iosApp/Configuration/Config.xcconfig` file. 206 | 2. Set your `TEAM_ID`. 207 | 3. Re-open the project in Android Studio. It should show the registered iOS device in the `iosApp` run configuration. 208 | 209 | ## Make your first changes 210 | 211 | You can now make some changes in the code and check that they are visible in both the iOS and Android applications at the same time: 212 | 213 | 1. In Android Studio, navigate to the `shared/src/commonMain/kotlin/App.kt` file. 214 | This is the common entry point for your Compose Multiplatform app. 215 | 216 | Here, you see the code responsible for rendering the "Hello, World!" button and the animated Compose Multiplatform logo: 217 | 218 | ```kotlin 219 | @OptIn(ExperimentalResourceApi::class) 220 | @Composable 221 | fun App() { 222 | MaterialTheme { 223 | var greetingText by remember { mutableStateOf("Hello, World!") } 224 | var showImage by remember { mutableStateOf(false) } 225 | Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) { 226 | Button(onClick = { 227 | greetingText = "Hello, ${getPlatformName()}" 228 | showImage = !showImage 229 | }) { 230 | Text(greetingText) 231 | } 232 | AnimatedVisibility(showImage) { 233 | Image( 234 | painterResource("compose-multiplatform.xml"), 235 | null 236 | ) 237 | } 238 | } 239 | } 240 | } 241 | ``` 242 | 243 | 2. Update the shared code by adding a text field that will update the name displayed on the button: 244 | 245 | ```diff 246 | @OptIn(ExperimentalResourceApi::class) 247 | @Composable 248 | fun App() { 249 | MaterialTheme { 250 | var greetingText by remember { mutableStateOf("Hello, World!") } 251 | var showImage by remember { mutableStateOf(false) } 252 | Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) { 253 | Button(onClick = { 254 | greetingText = "Hello, ${getPlatformName()}" 255 | showImage = !showImage 256 | }) { 257 | Text(greetingText) 258 | } 259 | + TextField(greetingText, onValueChange = { greetingText = it }) 260 | AnimatedVisibility(showImage) { 261 | Image( 262 | painterResource("compose-multiplatform.xml"), 263 | null 264 | ) 265 | } 266 | } 267 | } 268 | } 269 | ``` 270 | 271 | 3. Re-run both the `androidApp` and `iosApp` configurations. You'll see this change reflected in both the Android and iOS apps: 272 | 273 | 274 | 275 | ## How to configure the iOS application 276 | 277 | To get a better understanding of this template's setup and learn how to configure the basic properties of your iOS app without Xcode, 278 | open the `iosApp/Configuration/Config.xcconfig` file in Android Studio. The configuration file contains: 279 | 280 | * `APP_NAME`, a target executable and an application bundle name. 281 | * `BUNDLE_ID`, which [uniquely identifies the app throughout the system](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleidentifier#discussion). 282 | * `TEAM_ID`, [a unique identifier generated by Apple that's assigned to your team](https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/#:~:text=A%20Team%20ID%20is%20a,developer%20in%20App%20Store%20Connect). 283 | 284 | To configure the `APP_NAME` option, open `Config.xcconfig` in any text editor *before opening* the project in Android Studio, and then set the desired name. 285 | 286 | If you need to change this option after you open the project in Android Studio, do the following: 287 | 288 | 1. Close the project in Android Studio. 289 | 2. Run `./cleanup.sh` in your terminal. 290 | 3. Change the setting. 291 | 4. Open the project in Android Studio again. 292 | 293 | To configure advanced settings, use Xcode. After opening the project in Android Studio, 294 | open the `iosApp/iosApp.xcworkspace` file in Xcode and make changes there. 295 | 296 | ## Next steps 297 | 298 | We encourage you to explore Compose Multiplatform further and try out more projects: 299 | 300 | * [Learn about other cases for using the Compose Multiplatform UI framework](https://github.com/JetBrains/compose-multiplatform#readme) 301 | * [Create an application targeting Windows, macOS, and Linux with Compose Multiplatform for Desktop](https://github.com/JetBrains/compose-multiplatform-desktop-template#readme) 302 | * [Complete more Compose Multiplatform tutorials](https://github.com/JetBrains/compose-multiplatform/blob/master/tutorials/README.md) 303 | * [Explore some more advanced Compose Multiplatform example projects](https://github.com/JetBrains/compose-multiplatform/blob/master/examples/README.md) 304 | -------------------------------------------------------------------------------- /iosApp/iosApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 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 | CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 19 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 20 | 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; 21 | 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = ""; }; 22 | 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 7555FF7B242A565900829871 /* My application.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "My application.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 25 | 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; 27 | FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.release.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.release.xcconfig"; sourceTree = ""; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | F85CB1118929364A9C6EFABC /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 2147483647; 34 | files = ( 35 | CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */, 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 058557D7273AAEEB004C7B11 /* Preview Content */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */, 46 | ); 47 | path = "Preview Content"; 48 | sourceTree = ""; 49 | }; 50 | 42799AB246E5F90AF97AA0EF /* Frameworks */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */, 54 | ); 55 | name = Frameworks; 56 | sourceTree = ""; 57 | }; 58 | 7555FF72242A565900829871 = { 59 | isa = PBXGroup; 60 | children = ( 61 | AB1DB47929225F7C00F7AF9C /* Configuration */, 62 | 7555FF7D242A565900829871 /* iosApp */, 63 | 7555FF7C242A565900829871 /* Products */, 64 | FEFF387C0A8D172AA4D59CAE /* Pods */, 65 | 42799AB246E5F90AF97AA0EF /* Frameworks */, 66 | ); 67 | sourceTree = ""; 68 | }; 69 | 7555FF7C242A565900829871 /* Products */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 7555FF7B242A565900829871 /* My application.app */, 73 | ); 74 | name = Products; 75 | sourceTree = ""; 76 | }; 77 | 7555FF7D242A565900829871 /* iosApp */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 058557BA273AAA24004C7B11 /* Assets.xcassets */, 81 | 7555FF82242A565900829871 /* ContentView.swift */, 82 | 7555FF8C242A565B00829871 /* Info.plist */, 83 | 2152FB032600AC8F00CF470E /* iOSApp.swift */, 84 | 058557D7273AAEEB004C7B11 /* Preview Content */, 85 | ); 86 | path = iosApp; 87 | sourceTree = ""; 88 | }; 89 | AB1DB47929225F7C00F7AF9C /* Configuration */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | AB3632DC29227652001CCB65 /* Config.xcconfig */, 93 | ); 94 | path = Configuration; 95 | sourceTree = ""; 96 | }; 97 | FEFF387C0A8D172AA4D59CAE /* Pods */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */, 101 | FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */, 102 | ); 103 | path = Pods; 104 | sourceTree = ""; 105 | }; 106 | /* End PBXGroup section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | 7555FF7A242A565900829871 /* iosApp */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; 112 | buildPhases = ( 113 | 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */, 114 | 7555FF77242A565900829871 /* Sources */, 115 | 7555FF79242A565900829871 /* Resources */, 116 | F85CB1118929364A9C6EFABC /* Frameworks */, 117 | 2134C13603D0B299603D9F49 /* [CP] Copy Pods Resources */, 118 | 22E92CE52A1BC68600D3359B /* Copy moko-resoruces */, 119 | ); 120 | buildRules = ( 121 | ); 122 | dependencies = ( 123 | ); 124 | name = iosApp; 125 | productName = iosApp; 126 | productReference = 7555FF7B242A565900829871 /* My application.app */; 127 | productType = "com.apple.product-type.application"; 128 | }; 129 | /* End PBXNativeTarget section */ 130 | 131 | /* Begin PBXProject section */ 132 | 7555FF73242A565900829871 /* Project object */ = { 133 | isa = PBXProject; 134 | attributes = { 135 | LastSwiftUpdateCheck = 1130; 136 | LastUpgradeCheck = 1130; 137 | ORGANIZATIONNAME = orgName; 138 | TargetAttributes = { 139 | 7555FF7A242A565900829871 = { 140 | CreatedOnToolsVersion = 11.3.1; 141 | }; 142 | }; 143 | }; 144 | buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; 145 | compatibilityVersion = "Xcode 9.3"; 146 | developmentRegion = en; 147 | hasScannedForEncodings = 0; 148 | knownRegions = ( 149 | en, 150 | Base, 151 | ); 152 | mainGroup = 7555FF72242A565900829871; 153 | productRefGroup = 7555FF7C242A565900829871 /* Products */; 154 | projectDirPath = ""; 155 | projectRoot = ""; 156 | targets = ( 157 | 7555FF7A242A565900829871 /* iosApp */, 158 | ); 159 | }; 160 | /* End PBXProject section */ 161 | 162 | /* Begin PBXResourcesBuildPhase section */ 163 | 7555FF79242A565900829871 /* Resources */ = { 164 | isa = PBXResourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */, 168 | 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXResourcesBuildPhase section */ 173 | 174 | /* Begin PBXShellScriptBuildPhase section */ 175 | 2134C13603D0B299603D9F49 /* [CP] Copy Pods Resources */ = { 176 | isa = PBXShellScriptBuildPhase; 177 | buildActionMask = 2147483647; 178 | files = ( 179 | ); 180 | inputFileListPaths = ( 181 | "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-input-files.xcfilelist", 182 | ); 183 | name = "[CP] Copy Pods Resources"; 184 | outputFileListPaths = ( 185 | "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-output-files.xcfilelist", 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | shellPath = /bin/sh; 189 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources.sh\"\n"; 190 | showEnvVarsInLog = 0; 191 | }; 192 | 22E92CE52A1BC68600D3359B /* Copy moko-resoruces */ = { 193 | isa = PBXShellScriptBuildPhase; 194 | alwaysOutOfDate = 1; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | ); 198 | inputFileListPaths = ( 199 | ); 200 | inputPaths = ( 201 | ); 202 | name = "Copy moko-resoruces"; 203 | outputFileListPaths = ( 204 | ); 205 | outputPaths = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "\"$SRCROOT/../gradlew\" -p \"$SRCROOT/../\" :shared:copyFrameworkResourcesToApp \\\n -Pmoko.resources.PLATFORM_NAME=\"$PLATFORM_NAME\" \\\n -Pmoko.resources.CONFIGURATION=\"$CONFIGURATION\" \\\n -Pmoko.resources.ARCHS=\"$ARCHS\" \\\n -Pmoko.resources.BUILT_PRODUCTS_DIR=\"$BUILT_PRODUCTS_DIR\" \\\n -Pmoko.resources.CONTENTS_FOLDER_PATH=\"$CONTENTS_FOLDER_PATH\" --stacktrace \n"; 210 | }; 211 | 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */ = { 212 | isa = PBXShellScriptBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | inputFileListPaths = ( 217 | ); 218 | inputPaths = ( 219 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 220 | "${PODS_ROOT}/Manifest.lock", 221 | ); 222 | name = "[CP] Check Pods Manifest.lock"; 223 | outputFileListPaths = ( 224 | ); 225 | outputPaths = ( 226 | "$(DERIVED_FILE_DIR)/Pods-iosApp-checkManifestLockResult.txt", 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | shellPath = /bin/sh; 230 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 231 | showEnvVarsInLog = 0; 232 | }; 233 | /* End PBXShellScriptBuildPhase section */ 234 | 235 | /* Begin PBXSourcesBuildPhase section */ 236 | 7555FF77242A565900829871 /* Sources */ = { 237 | isa = PBXSourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, 241 | 7555FF83242A565900829871 /* ContentView.swift in Sources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXSourcesBuildPhase section */ 246 | 247 | /* Begin XCBuildConfiguration section */ 248 | 7555FFA3242A565B00829871 /* Debug */ = { 249 | isa = XCBuildConfiguration; 250 | baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; 251 | buildSettings = { 252 | ALWAYS_SEARCH_USER_PATHS = NO; 253 | CLANG_ANALYZER_NONNULL = YES; 254 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 255 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 256 | CLANG_CXX_LIBRARY = "libc++"; 257 | CLANG_ENABLE_MODULES = YES; 258 | CLANG_ENABLE_OBJC_ARC = YES; 259 | CLANG_ENABLE_OBJC_WEAK = YES; 260 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 261 | CLANG_WARN_BOOL_CONVERSION = YES; 262 | CLANG_WARN_COMMA = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 265 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 266 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 267 | CLANG_WARN_EMPTY_BODY = YES; 268 | CLANG_WARN_ENUM_CONVERSION = YES; 269 | CLANG_WARN_INFINITE_RECURSION = YES; 270 | CLANG_WARN_INT_CONVERSION = YES; 271 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 272 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 273 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 274 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 275 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 276 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 277 | CLANG_WARN_STRICT_PROTOTYPES = YES; 278 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 279 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 280 | CLANG_WARN_UNREACHABLE_CODE = YES; 281 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 282 | COPY_PHASE_STRIP = NO; 283 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 284 | ENABLE_STRICT_OBJC_MSGSEND = YES; 285 | ENABLE_TESTABILITY = YES; 286 | GCC_C_LANGUAGE_STANDARD = gnu11; 287 | GCC_DYNAMIC_NO_PIC = NO; 288 | GCC_NO_COMMON_BLOCKS = YES; 289 | GCC_OPTIMIZATION_LEVEL = 0; 290 | GCC_PREPROCESSOR_DEFINITIONS = ( 291 | "DEBUG=1", 292 | "$(inherited)", 293 | ); 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 14.1; 301 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 302 | MTL_FAST_MATH = YES; 303 | ONLY_ACTIVE_ARCH = YES; 304 | SDKROOT = iphoneos; 305 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 306 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 307 | }; 308 | name = Debug; 309 | }; 310 | 7555FFA4242A565B00829871 /* Release */ = { 311 | isa = XCBuildConfiguration; 312 | baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_ANALYZER_NONNULL = YES; 316 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_ENABLE_OBJC_WEAK = YES; 322 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_COMMA = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 329 | CLANG_WARN_EMPTY_BODY = YES; 330 | CLANG_WARN_ENUM_CONVERSION = YES; 331 | CLANG_WARN_INFINITE_RECURSION = YES; 332 | CLANG_WARN_INT_CONVERSION = YES; 333 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 334 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 335 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 338 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 339 | CLANG_WARN_STRICT_PROTOTYPES = YES; 340 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 341 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 342 | CLANG_WARN_UNREACHABLE_CODE = YES; 343 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 344 | COPY_PHASE_STRIP = NO; 345 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 346 | ENABLE_NS_ASSERTIONS = NO; 347 | ENABLE_STRICT_OBJC_MSGSEND = YES; 348 | GCC_C_LANGUAGE_STANDARD = gnu11; 349 | GCC_NO_COMMON_BLOCKS = YES; 350 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 351 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 352 | GCC_WARN_UNDECLARED_SELECTOR = YES; 353 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 354 | GCC_WARN_UNUSED_FUNCTION = YES; 355 | GCC_WARN_UNUSED_VARIABLE = YES; 356 | IPHONEOS_DEPLOYMENT_TARGET = 14.1; 357 | MTL_ENABLE_DEBUG_INFO = NO; 358 | MTL_FAST_MATH = YES; 359 | SDKROOT = iphoneos; 360 | SWIFT_COMPILATION_MODE = wholemodule; 361 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 362 | VALIDATE_PRODUCT = YES; 363 | }; 364 | name = Release; 365 | }; 366 | 7555FFA6242A565B00829871 /* Debug */ = { 367 | isa = XCBuildConfiguration; 368 | baseConfigurationReference = 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */; 369 | buildSettings = { 370 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 371 | CODE_SIGN_IDENTITY = "Apple Development"; 372 | CODE_SIGN_STYLE = Automatic; 373 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; 374 | DEVELOPMENT_TEAM = "${TEAM_ID}"; 375 | ENABLE_PREVIEWS = YES; 376 | INFOPLIST_FILE = iosApp/Info.plist; 377 | IPHONEOS_DEPLOYMENT_TARGET = 14.1; 378 | LD_RUNPATH_SEARCH_PATHS = ( 379 | "$(inherited)", 380 | "@executable_path/Frameworks", 381 | ); 382 | PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; 383 | PRODUCT_NAME = "${APP_NAME}"; 384 | PROVISIONING_PROFILE_SPECIFIER = ""; 385 | SWIFT_VERSION = 5.0; 386 | TARGETED_DEVICE_FAMILY = "1,2"; 387 | }; 388 | name = Debug; 389 | }; 390 | 7555FFA7242A565B00829871 /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | baseConfigurationReference = FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */; 393 | buildSettings = { 394 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 395 | CODE_SIGN_IDENTITY = "Apple Development"; 396 | CODE_SIGN_STYLE = Automatic; 397 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; 398 | DEVELOPMENT_TEAM = "${TEAM_ID}"; 399 | ENABLE_PREVIEWS = YES; 400 | INFOPLIST_FILE = iosApp/Info.plist; 401 | IPHONEOS_DEPLOYMENT_TARGET = 14.1; 402 | LD_RUNPATH_SEARCH_PATHS = ( 403 | "$(inherited)", 404 | "@executable_path/Frameworks", 405 | ); 406 | PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; 407 | PRODUCT_NAME = "${APP_NAME}"; 408 | PROVISIONING_PROFILE_SPECIFIER = ""; 409 | SWIFT_VERSION = 5.0; 410 | TARGETED_DEVICE_FAMILY = "1,2"; 411 | }; 412 | name = Release; 413 | }; 414 | /* End XCBuildConfiguration section */ 415 | 416 | /* Begin XCConfigurationList section */ 417 | 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { 418 | isa = XCConfigurationList; 419 | buildConfigurations = ( 420 | 7555FFA3242A565B00829871 /* Debug */, 421 | 7555FFA4242A565B00829871 /* Release */, 422 | ); 423 | defaultConfigurationIsVisible = 0; 424 | defaultConfigurationName = Release; 425 | }; 426 | 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { 427 | isa = XCConfigurationList; 428 | buildConfigurations = ( 429 | 7555FFA6242A565B00829871 /* Debug */, 430 | 7555FFA7242A565B00829871 /* Release */, 431 | ); 432 | defaultConfigurationIsVisible = 0; 433 | defaultConfigurationName = Release; 434 | }; 435 | /* End XCConfigurationList section */ 436 | }; 437 | rootObject = 7555FF73242A565900829871 /* Project object */; 438 | } 439 | --------------------------------------------------------------------------------