From 8ed753b1b9b0db7d5caa967c8523c7eef1566ec1 Mon Sep 17 00:00:00 2001 From: Nikita Lipsky Date: Thu, 23 Feb 2023 19:28:25 +0200 Subject: [PATCH] Add iOS target to multiplatform template (#2788) + conform KMM wizard generated project structure and samples --- .../multiplatform-template/.gitignore | 12 +- .../.run/android.run.xml | 59 --- .../{desktop.run.xml => desktopApp.run.xml} | 8 +- .../{android => androidApp}/build.gradle.kts | 21 +- .../src/androidMain}/AndroidManifest.xml | 0 .../kotlin}/com/myapplication/MainActivity.kt | 4 +- .../drawable-v24/ic_launcher_foreground.xml | 0 .../res/drawable/ic_launcher_background.xml | 0 .../res/mipmap-anydpi-v26/ic_launcher.xml | 0 .../mipmap-anydpi-v26/ic_launcher_round.xml | 0 .../res/mipmap-hdpi/ic_launcher.png | Bin .../res/mipmap-hdpi/ic_launcher_round.png | Bin .../res/mipmap-mdpi/ic_launcher.png | Bin .../res/mipmap-mdpi/ic_launcher_round.png | Bin .../res/mipmap-xhdpi/ic_launcher.png | Bin .../res/mipmap-xhdpi/ic_launcher_round.png | Bin .../res/mipmap-xxhdpi/ic_launcher.png | Bin .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin .../res/mipmap-xxxhdpi/ic_launcher.png | Bin .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin .../src/androidMain}/res/values/strings.xml | 0 .../multiplatform-template/build.gradle.kts | 2 +- .../common/build.gradle.kts | 49 --- .../src/androidMain/kotlin/AndroidApp.kt | 1 - .../{desktop => desktopApp}/build.gradle.kts | 10 +- .../src/jvmMain/kotlin/main.kt | 2 +- .../multiplatform-template/gradle.properties | 17 +- .../iosApp/Configuration/TeamId.xcconfig | 1 + .../multiplatform-template/iosApp/Podfile | 5 + .../iosApp/iosApp.xcodeproj/project.pbxproj | 398 ++++++++++++++++++ .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 98 +++++ .../iosApp/Assets.xcassets/Contents.json | 6 + .../iosApp/iosApp/ContentView.swift | 21 + .../iosApp/iosApp/Info.plist | 48 +++ .../Preview Assets.xcassets/Contents.json | 6 + .../iosApp/iosApp/iOSApp.swift | 10 + .../settings.gradle.kts | 23 +- .../shared/build.gradle.kts | 71 ++++ .../src/androidMain/AndroidManifest.xml | 0 .../src/androidMain/kotlin/main.android.kt | 5 + .../src/commonMain/kotlin/App.kt | 2 +- .../src/desktopMain/kotlin/main.desktop.kt} | 2 + .../shared/src/iosMain/kotlin/main.ios.kt | 5 + 44 files changed, 749 insertions(+), 148 deletions(-) delete mode 100644 experimental/templates/multiplatform-template/.run/android.run.xml rename experimental/templates/multiplatform-template/.run/{desktop.run.xml => desktopApp.run.xml} (63%) rename experimental/templates/multiplatform-template/{android => androidApp}/build.gradle.kts (57%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/AndroidManifest.xml (100%) rename experimental/templates/multiplatform-template/{android/src/main/java => androidApp/src/androidMain/kotlin}/com/myapplication/MainActivity.kt (89%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/drawable-v24/ic_launcher_foreground.xml (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/drawable/ic_launcher_background.xml (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-anydpi-v26/ic_launcher.xml (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-anydpi-v26/ic_launcher_round.xml (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-hdpi/ic_launcher.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-hdpi/ic_launcher_round.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-mdpi/ic_launcher.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-mdpi/ic_launcher_round.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-xhdpi/ic_launcher.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-xhdpi/ic_launcher_round.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-xxhdpi/ic_launcher.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-xxhdpi/ic_launcher_round.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/mipmap-xxxhdpi/ic_launcher_round.png (100%) rename experimental/templates/multiplatform-template/{android/src/main => androidApp/src/androidMain}/res/values/strings.xml (100%) delete mode 100644 experimental/templates/multiplatform-template/common/build.gradle.kts delete mode 100644 experimental/templates/multiplatform-template/common/src/androidMain/kotlin/AndroidApp.kt rename experimental/templates/multiplatform-template/{desktop => desktopApp}/build.gradle.kts (79%) rename experimental/templates/multiplatform-template/{desktop => desktopApp}/src/jvmMain/kotlin/main.kt (89%) create mode 100644 experimental/templates/multiplatform-template/iosApp/Configuration/TeamId.xcconfig create mode 100644 experimental/templates/multiplatform-template/iosApp/Podfile create mode 100644 experimental/templates/multiplatform-template/iosApp/iosApp.xcodeproj/project.pbxproj create mode 100644 experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/Contents.json create mode 100644 experimental/templates/multiplatform-template/iosApp/iosApp/ContentView.swift create mode 100644 experimental/templates/multiplatform-template/iosApp/iosApp/Info.plist create mode 100644 experimental/templates/multiplatform-template/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 experimental/templates/multiplatform-template/iosApp/iosApp/iOSApp.swift create mode 100644 experimental/templates/multiplatform-template/shared/build.gradle.kts rename experimental/templates/multiplatform-template/{common => shared}/src/androidMain/AndroidManifest.xml (100%) create mode 100644 experimental/templates/multiplatform-template/shared/src/androidMain/kotlin/main.android.kt rename experimental/templates/multiplatform-template/{common => shared}/src/commonMain/kotlin/App.kt (90%) rename experimental/templates/multiplatform-template/{common/src/desktopMain/kotlin/DesktopApp.kt => shared/src/desktopMain/kotlin/main.desktop.kt} (84%) create mode 100644 experimental/templates/multiplatform-template/shared/src/iosMain/kotlin/main.ios.kt diff --git a/experimental/templates/multiplatform-template/.gitignore b/experimental/templates/multiplatform-template/.gitignore index a32b16597b..6e5f30477c 100644 --- a/experimental/templates/multiplatform-template/.gitignore +++ b/experimental/templates/multiplatform-template/.gitignore @@ -2,14 +2,14 @@ .gradle /local.properties /.idea -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml .DS_Store build/ /captures .externalNativeBuild .cxx +iosApp/Podfile.lock +iosApp/Pods/* +iosApp/iosApp.xcworkspace/* +iosApp/iosApp.xcodeproj/* +!iosApp/iosApp.xcodeproj/project.pbxproj +shared/shared.podspec diff --git a/experimental/templates/multiplatform-template/.run/android.run.xml b/experimental/templates/multiplatform-template/.run/android.run.xml deleted file mode 100644 index a9dd595f84..0000000000 --- a/experimental/templates/multiplatform-template/.run/android.run.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/.run/desktop.run.xml b/experimental/templates/multiplatform-template/.run/desktopApp.run.xml similarity index 63% rename from experimental/templates/multiplatform-template/.run/desktop.run.xml rename to experimental/templates/multiplatform-template/.run/desktopApp.run.xml index d9335c1be5..95395e11ee 100644 --- a/experimental/templates/multiplatform-template/.run/desktop.run.xml +++ b/experimental/templates/multiplatform-template/.run/desktopApp.run.xml @@ -1,8 +1,8 @@ - + - true + true + true + false \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/android/build.gradle.kts b/experimental/templates/multiplatform-template/androidApp/build.gradle.kts similarity index 57% rename from experimental/templates/multiplatform-template/android/build.gradle.kts rename to experimental/templates/multiplatform-template/androidApp/build.gradle.kts index fed67b2b03..b3741995c0 100644 --- a/experimental/templates/multiplatform-template/android/build.gradle.kts +++ b/experimental/templates/multiplatform-template/androidApp/build.gradle.kts @@ -1,26 +1,31 @@ plugins { + kotlin("multiplatform") id("com.android.application") - kotlin("android") id("org.jetbrains.compose") } +kotlin { + android() + sourceSets { + val androidMain by getting { + dependencies { + implementation(project(":shared")) + } + } + } +} + android { compileSdk = 33 - defaultConfig { + applicationId = "com.myapplication.MyApplication" minSdk = 26 targetSdk = 33 versionCode = 1 versionName = "1.0" } - compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } } - -dependencies { - implementation(project(":common")) - implementation("androidx.activity:activity-compose:1.5.0") -} diff --git a/experimental/templates/multiplatform-template/android/src/main/AndroidManifest.xml b/experimental/templates/multiplatform-template/androidApp/src/androidMain/AndroidManifest.xml similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/AndroidManifest.xml rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/AndroidManifest.xml diff --git a/experimental/templates/multiplatform-template/android/src/main/java/com/myapplication/MainActivity.kt b/experimental/templates/multiplatform-template/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt similarity index 89% rename from experimental/templates/multiplatform-template/android/src/main/java/com/myapplication/MainActivity.kt rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt index 52cb3575e1..fd6e831ceb 100644 --- a/experimental/templates/multiplatform-template/android/src/main/java/com/myapplication/MainActivity.kt +++ b/experimental/templates/multiplatform-template/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt @@ -1,6 +1,6 @@ package com.myapplication -import App +import MainView import android.os.Bundle import androidx.activity.compose.setContent import androidx.appcompat.app.AppCompatActivity @@ -10,7 +10,7 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContent { - App() + MainView() } } } \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/android/src/main/res/drawable-v24/ic_launcher_foreground.xml b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml diff --git a/experimental/templates/multiplatform-template/android/src/main/res/drawable/ic_launcher_background.xml b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/drawable/ic_launcher_background.xml rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-hdpi/ic_launcher.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-hdpi/ic_launcher.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-hdpi/ic_launcher_round.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-hdpi/ic_launcher_round.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-mdpi/ic_launcher.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-mdpi/ic_launcher.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-mdpi/ic_launcher_round.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-mdpi/ic_launcher_round.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-xhdpi/ic_launcher.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-xhdpi/ic_launcher.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-xhdpi/ic_launcher_round.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-xxhdpi/ic_launcher.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/experimental/templates/multiplatform-template/android/src/main/res/values/strings.xml b/experimental/templates/multiplatform-template/androidApp/src/androidMain/res/values/strings.xml similarity index 100% rename from experimental/templates/multiplatform-template/android/src/main/res/values/strings.xml rename to experimental/templates/multiplatform-template/androidApp/src/androidMain/res/values/strings.xml diff --git a/experimental/templates/multiplatform-template/build.gradle.kts b/experimental/templates/multiplatform-template/build.gradle.kts index bf95fe23b1..0c00883af5 100644 --- a/experimental/templates/multiplatform-template/build.gradle.kts +++ b/experimental/templates/multiplatform-template/build.gradle.kts @@ -9,7 +9,7 @@ plugins { id("org.jetbrains.compose") apply false } -subprojects { +allprojects { repositories { google() mavenCentral() diff --git a/experimental/templates/multiplatform-template/common/build.gradle.kts b/experimental/templates/multiplatform-template/common/build.gradle.kts deleted file mode 100644 index 8cb4ff1713..0000000000 --- a/experimental/templates/multiplatform-template/common/build.gradle.kts +++ /dev/null @@ -1,49 +0,0 @@ -plugins { - id("com.android.library") - kotlin("multiplatform") - id("org.jetbrains.compose") -} - -kotlin { - android() - jvm("desktop") - - sourceSets { - named("commonMain") { - dependencies { - api(compose.runtime) - api(compose.foundation) - api(compose.material) - // Needed only for preview. - implementation(compose.preview) - } - } - named("androidMain") { - dependencies { - api("androidx.appcompat:appcompat:1.5.1") - api("androidx.core:core-ktx:1.8.0") - } - } - } -} - -android { - compileSdk = 33 - - defaultConfig { - minSdk = 26 - targetSdk = 33 - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - - sourceSets { - named("main") { - manifest.srcFile("src/androidMain/AndroidManifest.xml") - res.srcDirs("src/androidMain/res") - } - } -} diff --git a/experimental/templates/multiplatform-template/common/src/androidMain/kotlin/AndroidApp.kt b/experimental/templates/multiplatform-template/common/src/androidMain/kotlin/AndroidApp.kt deleted file mode 100644 index 7d338f024a..0000000000 --- a/experimental/templates/multiplatform-template/common/src/androidMain/kotlin/AndroidApp.kt +++ /dev/null @@ -1 +0,0 @@ -actual fun getPlatformName(): String = "Android" \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/desktop/build.gradle.kts b/experimental/templates/multiplatform-template/desktopApp/build.gradle.kts similarity index 79% rename from experimental/templates/multiplatform-template/desktop/build.gradle.kts rename to experimental/templates/multiplatform-template/desktopApp/build.gradle.kts index e2f2d8466f..acdd0ad2f4 100644 --- a/experimental/templates/multiplatform-template/desktop/build.gradle.kts +++ b/experimental/templates/multiplatform-template/desktopApp/build.gradle.kts @@ -1,19 +1,17 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { - kotlin("multiplatform") + kotlin("multiplatform") id("org.jetbrains.compose") } kotlin { - jvm { - withJava() - } + jvm {} sourceSets { - named("jvmMain") { + val jvmMain by getting { dependencies { implementation(compose.desktop.currentOs) - implementation(project(":common")) + implementation(project(":shared")) } } } diff --git a/experimental/templates/multiplatform-template/desktop/src/jvmMain/kotlin/main.kt b/experimental/templates/multiplatform-template/desktopApp/src/jvmMain/kotlin/main.kt similarity index 89% rename from experimental/templates/multiplatform-template/desktop/src/jvmMain/kotlin/main.kt rename to experimental/templates/multiplatform-template/desktopApp/src/jvmMain/kotlin/main.kt index 2543564b01..5ffada98e1 100644 --- a/experimental/templates/multiplatform-template/desktop/src/jvmMain/kotlin/main.kt +++ b/experimental/templates/multiplatform-template/desktopApp/src/jvmMain/kotlin/main.kt @@ -3,6 +3,6 @@ import androidx.compose.ui.window.application fun main() = application { Window(onCloseRequest = ::exitApplication) { - App() + MainView() } } \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/gradle.properties b/experimental/templates/multiplatform-template/gradle.properties index 74d4ea7297..3cc2f2ec8c 100644 --- a/experimental/templates/multiplatform-template/gradle.properties +++ b/experimental/templates/multiplatform-template/gradle.properties @@ -1,7 +1,16 @@ -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -android.useAndroidX=true -android.enableJetifier=true kotlin.code.style=official +xcodeproj=./iosApp +kotlin.native.cocoapods.generate.wrapper=true +android.useAndroidX=true +org.gradle.jvmargs=-Xmx3g +org.jetbrains.compose.experimental.jscanvas.enabled=true +org.jetbrains.compose.experimental.macos.enabled=true +org.jetbrains.compose.experimental.uikit.enabled=true +kotlin.native.cacheKind=none +kotlin.native.useEmbeddableCompilerJar=true +kotlin.mpp.androidSourceSetLayoutVersion=2 +# Enable kotlin/native experimental memory model +kotlin.native.binary.memoryModel=experimental kotlin.version=1.8.0 agp.version=7.1.3 -compose.version=1.3.0 +compose.version=1.4.0-alpha01-dev950 diff --git a/experimental/templates/multiplatform-template/iosApp/Configuration/TeamId.xcconfig b/experimental/templates/multiplatform-template/iosApp/Configuration/TeamId.xcconfig new file mode 100644 index 0000000000..bf06eb27e9 --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/Configuration/TeamId.xcconfig @@ -0,0 +1 @@ +TEAM_ID= diff --git a/experimental/templates/multiplatform-template/iosApp/Podfile b/experimental/templates/multiplatform-template/iosApp/Podfile new file mode 100644 index 0000000000..aff9c517b2 --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/Podfile @@ -0,0 +1,5 @@ +target 'iosApp' do + use_frameworks! + platform :ios, '14.1' + pod 'shared', :path => '../shared' +end \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/iosApp/iosApp.xcodeproj/project.pbxproj b/experimental/templates/multiplatform-template/iosApp/iosApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..d036d32452 --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/iosApp.xcodeproj/project.pbxproj @@ -0,0 +1,398 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; + 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 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 = ""; }; + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF7B242A565900829871 /* MyApplication.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MyApplication.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB3632DC29227652001CCB65 /* TeamId.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = TeamId.xcconfig; sourceTree = ""; }; + 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 = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F85CB1118929364A9C6EFABC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 058557D7273AAEEB004C7B11 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 42799AB246E5F90AF97AA0EF /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 7555FF72242A565900829871 = { + isa = PBXGroup; + children = ( + AB1DB47929225F7C00F7AF9C /* Configuration */, + 7555FF7D242A565900829871 /* iosApp */, + 7555FF7C242A565900829871 /* Products */, + FEFF387C0A8D172AA4D59CAE /* Pods */, + 42799AB246E5F90AF97AA0EF /* Frameworks */, + ); + sourceTree = ""; + }; + 7555FF7C242A565900829871 /* Products */ = { + isa = PBXGroup; + children = ( + 7555FF7B242A565900829871 /* MyApplication.app */, + ); + name = Products; + sourceTree = ""; + }; + 7555FF7D242A565900829871 /* iosApp */ = { + isa = PBXGroup; + children = ( + 058557BA273AAA24004C7B11 /* Assets.xcassets */, + 7555FF82242A565900829871 /* ContentView.swift */, + 7555FF8C242A565B00829871 /* Info.plist */, + 2152FB032600AC8F00CF470E /* iOSApp.swift */, + 058557D7273AAEEB004C7B11 /* Preview Content */, + ); + path = iosApp; + sourceTree = ""; + }; + AB1DB47929225F7C00F7AF9C /* Configuration */ = { + isa = PBXGroup; + children = ( + AB3632DC29227652001CCB65 /* TeamId.xcconfig */, + ); + path = Configuration; + sourceTree = ""; + }; + FEFF387C0A8D172AA4D59CAE /* Pods */ = { + isa = PBXGroup; + children = ( + 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */, + FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7555FF7A242A565900829871 /* iosApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; + buildPhases = ( + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */, + 7555FF77242A565900829871 /* Sources */, + 7555FF79242A565900829871 /* Resources */, + F85CB1118929364A9C6EFABC /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = iosApp; + productName = iosApp; + productReference = 7555FF7B242A565900829871 /* MyApplication.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7555FF73242A565900829871 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1130; + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = orgName; + TargetAttributes = { + 7555FF7A242A565900829871 = { + CreatedOnToolsVersion = 11.3.1; + }; + }; + }; + buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7555FF72242A565900829871; + productRefGroup = 7555FF7C242A565900829871 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7555FF7A242A565900829871 /* iosApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7555FF79242A565900829871 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-iosApp-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + 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"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7555FF77242A565900829871 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, + 7555FF83242A565900829871 /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 7555FFA3242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* TeamId.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7555FFA4242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* TeamId.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7555FFA6242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.myapplication.MyApplication${TEAM_ID}"; + PRODUCT_NAME = MyApplication; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7555FFA7242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.myapplication.MyApplication${TEAM_ID}"; + PRODUCT_NAME = MyApplication; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA3242A565B00829871 /* Debug */, + 7555FFA4242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA6242A565B00829871 /* Debug */, + 7555FFA7242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7555FF73242A565900829871 /* Project object */; +} diff --git a/experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000000..ee7e3ca03f --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..fb88a396bf --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/Contents.json b/experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/iosApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/iosApp/iosApp/ContentView.swift b/experimental/templates/multiplatform-template/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..f7f6457b31 --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import UIKit +import SwiftUI +import shared + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} + +struct ContentView: View { + var body: some View { + ComposeView() + .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + } +} + + + diff --git a/experimental/templates/multiplatform-template/iosApp/iosApp/Info.plist b/experimental/templates/multiplatform-template/iosApp/iosApp/Info.plist new file mode 100644 index 0000000000..9a269f5eaa --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/iosApp/Info.plist @@ -0,0 +1,48 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/experimental/templates/multiplatform-template/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/experimental/templates/multiplatform-template/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/iosApp/iosApp/iOSApp.swift b/experimental/templates/multiplatform-template/iosApp/iosApp/iOSApp.swift new file mode 100644 index 0000000000..0648e8602f --- /dev/null +++ b/experimental/templates/multiplatform-template/iosApp/iosApp/iOSApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct iOSApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} \ No newline at end of file diff --git a/experimental/templates/multiplatform-template/settings.gradle.kts b/experimental/templates/multiplatform-template/settings.gradle.kts index 55535932b5..e71ad4675f 100644 --- a/experimental/templates/multiplatform-template/settings.gradle.kts +++ b/experimental/templates/multiplatform-template/settings.gradle.kts @@ -6,13 +6,22 @@ pluginManagement { } plugins { - kotlin("jvm").version(extra["kotlin.version"] as String) - kotlin("multiplatform").version(extra["kotlin.version"] as String) - kotlin("android").version(extra["kotlin.version"] as String) - id("com.android.application").version(extra["agp.version"] as String) - id("com.android.library").version(extra["agp.version"] as String) - id("org.jetbrains.compose").version(extra["compose.version"] as String) + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + id("com.android.base").version(agpVersion) + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + id("org.jetbrains.compose").version(composeVersion) } } -include(":common", ":android", ":desktop") +rootProject.name = "My application" + +include(":androidApp") +include(":shared") +include(":desktopApp") diff --git a/experimental/templates/multiplatform-template/shared/build.gradle.kts b/experimental/templates/multiplatform-template/shared/build.gradle.kts new file mode 100644 index 0000000000..3e694e3926 --- /dev/null +++ b/experimental/templates/multiplatform-template/shared/build.gradle.kts @@ -0,0 +1,71 @@ +plugins { + kotlin("multiplatform") + kotlin("native.cocoapods") + id("com.android.library") + id("org.jetbrains.compose") +} + +version = "1.0-SNAPSHOT" + +kotlin { + android() + + jvm("desktop") + + ios() + iosSimulatorArm64() + + cocoapods { + summary = "Some description for the Shared Module" + homepage = "Link to the Shared Module homepage" + ios.deploymentTarget = "14.1" + podfile = project.file("../iosApp/Podfile") + framework { + baseName = "shared" + isStatic = true + } + extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']" + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + } + } + val androidMain by getting { + dependencies { + api("androidx.activity:activity-compose:1.6.1") + api("androidx.appcompat:appcompat:1.6.1") + api("androidx.core:core-ktx:1.9.0") + } + } + val iosMain by getting + val iosSimulatorArm64Main by getting { + dependsOn(iosMain) + } + val desktopMain by getting { + dependencies { + implementation(compose.desktop.common) + } + } + } +} + +android { + compileSdk = 33 + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + sourceSets["main"].res.srcDirs("src/androidMain/res") + sourceSets["main"].resources.srcDirs("src/commonMain/resources") + + defaultConfig { + minSdk = 26 + targetSdk = 33 + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} diff --git a/experimental/templates/multiplatform-template/common/src/androidMain/AndroidManifest.xml b/experimental/templates/multiplatform-template/shared/src/androidMain/AndroidManifest.xml similarity index 100% rename from experimental/templates/multiplatform-template/common/src/androidMain/AndroidManifest.xml rename to experimental/templates/multiplatform-template/shared/src/androidMain/AndroidManifest.xml diff --git a/experimental/templates/multiplatform-template/shared/src/androidMain/kotlin/main.android.kt b/experimental/templates/multiplatform-template/shared/src/androidMain/kotlin/main.android.kt new file mode 100644 index 0000000000..d5723a2381 --- /dev/null +++ b/experimental/templates/multiplatform-template/shared/src/androidMain/kotlin/main.android.kt @@ -0,0 +1,5 @@ +import androidx.compose.runtime.Composable + +actual fun getPlatformName(): String = "Android" + +@Composable fun MainView() = App() diff --git a/experimental/templates/multiplatform-template/common/src/commonMain/kotlin/App.kt b/experimental/templates/multiplatform-template/shared/src/commonMain/kotlin/App.kt similarity index 90% rename from experimental/templates/multiplatform-template/common/src/commonMain/kotlin/App.kt rename to experimental/templates/multiplatform-template/shared/src/commonMain/kotlin/App.kt index 543a87dabc..5d85f248ce 100644 --- a/experimental/templates/multiplatform-template/common/src/commonMain/kotlin/App.kt +++ b/experimental/templates/multiplatform-template/shared/src/commonMain/kotlin/App.kt @@ -8,7 +8,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @Composable -fun App() { +internal fun App() { MaterialTheme { var text by remember { mutableStateOf("Hello, World!") } diff --git a/experimental/templates/multiplatform-template/common/src/desktopMain/kotlin/DesktopApp.kt b/experimental/templates/multiplatform-template/shared/src/desktopMain/kotlin/main.desktop.kt similarity index 84% rename from experimental/templates/multiplatform-template/common/src/desktopMain/kotlin/DesktopApp.kt rename to experimental/templates/multiplatform-template/shared/src/desktopMain/kotlin/main.desktop.kt index fb85b30443..5f23de7dd9 100644 --- a/experimental/templates/multiplatform-template/common/src/desktopMain/kotlin/DesktopApp.kt +++ b/experimental/templates/multiplatform-template/shared/src/desktopMain/kotlin/main.desktop.kt @@ -3,6 +3,8 @@ import androidx.compose.runtime.Composable actual fun getPlatformName(): String = "Desktop" +@Composable fun MainView() = App() + @Preview @Composable fun AppPreview() { diff --git a/experimental/templates/multiplatform-template/shared/src/iosMain/kotlin/main.ios.kt b/experimental/templates/multiplatform-template/shared/src/iosMain/kotlin/main.ios.kt new file mode 100644 index 0000000000..1f0e256d13 --- /dev/null +++ b/experimental/templates/multiplatform-template/shared/src/iosMain/kotlin/main.ios.kt @@ -0,0 +1,5 @@ +import androidx.compose.ui.window.ComposeUIViewController + +actual fun getPlatformName(): String = "iOS" + +fun MainViewController() = ComposeUIViewController { App() } \ No newline at end of file