diff --git a/sample/molecule/build.gradle.kts b/sample/molecule/build.gradle.kts deleted file mode 100644 index 9ef58c62..00000000 --- a/sample/molecule/build.gradle.kts +++ /dev/null @@ -1,170 +0,0 @@ -import org.jetbrains.compose.desktop.application.dsl.TargetFormat -import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget -import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl -import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig - -plugins { - kotlin("multiplatform") - alias(libs.plugins.jetbrains.compose) - id("com.android.application") - alias(libs.plugins.compose.compiler) -} - -kotlin { - applyDefaultHierarchyTemplate() - listOf( - iosSimulatorArm64(), - iosArm64(), - iosX64(), - ) - androidTarget() - macosX64 { - binaries { - executable { - entryPoint = "moe.tlaster.precompose.molecule.sample.main" - freeCompilerArgs += listOf( - "-linker-option", "-framework", "-linker-option", "Metal", - ) - } - } - } - macosArm64 { - binaries { - executable { - entryPoint = "moe.tlaster.precompose.molecule.sample.main" - freeCompilerArgs += listOf( - "-linker-option", "-framework", "-linker-option", "Metal", - ) - } - } - } - jvm() - @OptIn(ExperimentalWasmDsl::class) - wasmJs { - moduleName = "composeApp" - browser { - val projectDirPath = project.projectDir.path - commonWebpackConfig { - outputFileName = "composeApp.js" - devServer = - (devServer ?: KotlinWebpackConfig.DevServer()).apply { - static = - (static ?: mutableListOf()).apply { - // Serve sources to debug inside browser - add(projectDirPath) - } - } - } - } - binaries.executable() - } - - sourceSets { - val commonMain by getting { - dependencies { - implementation(compose.ui) - implementation(compose.runtime) - implementation(compose.foundation) - implementation(compose.material) - implementation(project(":precompose")) - implementation(project(":precompose-molecule")) - implementation(libs.molecule.runtime) - } - } - val jvmMain by getting { - dependencies { - implementation(compose.desktop.currentOs) - } - } - val androidMain by getting { - dependencies { - implementation(libs.androidx.appcompat) - implementation(libs.androidx.activity.compose) - } - } - } - - targets.withType { - binaries.all { - // TODO: the current compose binary surprises LLVM, so disable checks for now. - freeCompilerArgs += "-Xdisable-phases=VerifyBitcode" - binaryOptions["memoryModel"] = "experimental" - } - } -} - -compose { - desktop { - application { - mainClass = "moe.tlaster.precompose.molecule.sample.MainKt" - nativeDistributions { - targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) - packageName = "moe.tlaster.precompose.sample.molecule" - packageVersion = "1.0.0" - macOS { - bundleID = "moe.tlaster.precompose.sample.molecule" - // iconFile.set(project.file("src/jvmMain/resources/icon/ic_launcher.icns")) - } - linux { - // iconFile.set(project.file("src/jvmMain/resources/icon/ic_launcher.png")) - } - windows { - shortcut = true - menu = true - // iconFile.set(project.file("src/jvmMain/resources/icon/ic_launcher.ico")) - } - } - } - nativeApplication { - targets(kotlin.targets.getByName("macosX64"), kotlin.targets.getByName("macosArm64")) - distributions { - targetFormats(TargetFormat.Dmg) - packageName = "moe.tlaster.precompose.sample.molecule" - packageVersion = "1.0.0" - macOS { - bundleID = "moe.tlaster.precompose.sample.molecule" - // iconFile.set(project.file("src/jvmMain/resources/icon/ic_launcher.icns")) - } - } - } - } - // experimental { - // uikit { - // application { - // bundleIdPrefix = "moe.tlaster.precompose.sample.molecule" - // projectName = "PreComposeMoleculeSample" - // deployConfigurations { - // simulator("Simulator") { - // device = org.jetbrains.compose.experimental.dsl.IOSDevices.IPHONE_13_MINI - // } - // } - // } - // } - // } -} - -android { - compileSdk = libs.versions.compileSdk.get().toInt() - namespace = "moe.tlaster.precompose.molecule.sample" - defaultConfig { - applicationId = "moe.tlaster.precompose.molecule.sample" - minSdk = libs.versions.minSdk.get().toInt() - targetSdk = libs.versions.compileSdk.get().toInt() - versionCode = 1 - versionName = "0.1.0" - } - sourceSets { - getByName("main") { - manifest.srcFile("src/androidMain/AndroidManifest.xml") - } - } - buildTypes { - getByName("release") { - isMinifyEnabled = false - } - } - compileOptions { - sourceCompatibility = JavaVersion.toVersion(libs.versions.java.get()) - targetCompatibility = JavaVersion.toVersion(libs.versions.java.get()) - } -} diff --git a/sample/molecule/composeApp/build.gradle.kts b/sample/molecule/composeApp/build.gradle.kts new file mode 100644 index 00000000..041c9c3c --- /dev/null +++ b/sample/molecule/composeApp/build.gradle.kts @@ -0,0 +1,117 @@ +import org.jetbrains.compose.desktop.application.dsl.TargetFormat +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig + +plugins { + kotlin("multiplatform") + alias(libs.plugins.jetbrains.compose) + id("com.android.application") + alias(libs.plugins.compose.compiler) +} + +kotlin { + applyDefaultHierarchyTemplate() + androidTarget { + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + jvmTarget.set(JvmTarget.JVM_11) + } + } + + listOf( + iosX64(), + iosArm64(), + iosSimulatorArm64(), + ).forEach { iosTarget -> + iosTarget.binaries.framework { + baseName = "ComposeApp" + isStatic = true + } + } + + jvm() + + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + moduleName = "composeApp" + browser { + val rootDirPath = project.rootDir.path + val projectDirPath = project.projectDir.path + commonWebpackConfig { + outputFileName = "composeApp.js" + devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply { + static = (static ?: mutableListOf()).apply { + // Serve sources to debug inside browser + add(rootDirPath) + add(projectDirPath) + } + } + } + } + binaries.executable() + } + + sourceSets { + androidMain.dependencies { + implementation(libs.androidx.appcompat) + implementation(libs.androidx.activity.compose) + } + commonMain.dependencies { + implementation(compose.ui) + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + implementation(project(":precompose")) + implementation(project(":precompose-molecule")) + implementation(libs.molecule.runtime) + } + jvmMain.dependencies { + implementation(compose.desktop.currentOs) + } + } +} + +android { + namespace = "moe.tlaster.precompose.molecule.sample" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + applicationId = "moe.tlaster.precompose.molecule.sample" + minSdk = libs.versions.minSdk.get().toInt() + targetSdk = libs.versions.compileSdk.get().toInt() + versionCode = 1 + versionName = "1.0" + } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} + +dependencies { + debugImplementation(compose.uiTooling) +} + +compose.desktop { + application { + mainClass = "moe.tlaster.precompose.molecule.sample.MainKt" + + nativeDistributions { + targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + packageName = "moe.tlaster.precompose.molecule.sample" + packageVersion = "1.0.0" + } + } +} diff --git a/sample/molecule/composeApp/src/androidMain/AndroidManifest.xml b/sample/molecule/composeApp/src/androidMain/AndroidManifest.xml new file mode 100644 index 00000000..c5db0b15 --- /dev/null +++ b/sample/molecule/composeApp/src/androidMain/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sample/molecule/src/androidMain/kotlin/moe/tlaster/precompose/molecule/sample/MainActivity.kt b/sample/molecule/composeApp/src/androidMain/kotlin/moe/tlaster/precompose/molecule/sample/MainActivity.kt similarity index 53% rename from sample/molecule/src/androidMain/kotlin/moe/tlaster/precompose/molecule/sample/MainActivity.kt rename to sample/molecule/composeApp/src/androidMain/kotlin/moe/tlaster/precompose/molecule/sample/MainActivity.kt index 7d329a83..cc572dc7 100644 --- a/sample/molecule/src/androidMain/kotlin/moe/tlaster/precompose/molecule/sample/MainActivity.kt +++ b/sample/molecule/composeApp/src/androidMain/kotlin/moe/tlaster/precompose/molecule/sample/MainActivity.kt @@ -1,14 +1,23 @@ package moe.tlaster.precompose.molecule.sample import android.os.Bundle +import androidx.activity.ComponentActivity import androidx.activity.compose.setContent -import androidx.fragment.app.FragmentActivity +import androidx.compose.runtime.Composable +import androidx.compose.ui.tooling.preview.Preview -class MainActivity : FragmentActivity() { +class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + setContent { App() } } } + +@Preview +@Composable +fun AppAndroidPreview() { + App() +} diff --git a/sample/molecule/composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml b/sample/molecule/composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/sample/molecule/composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sample/molecule/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml b/sample/molecule/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..e93e11ad --- /dev/null +++ b/sample/molecule/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/sample/molecule/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/sample/molecule/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sample/molecule/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/sample/molecule/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..a571e600 Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 00000000..61da551c Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..c41dd285 Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 00000000..db5080a7 Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..6dba46da Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 00000000..da31a871 Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..15ac6817 Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..b216f2d3 Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..f25a4197 Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png b/sample/molecule/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..e96783cc Binary files /dev/null and b/sample/molecule/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/sample/molecule/composeApp/src/androidMain/res/values/strings.xml b/sample/molecule/composeApp/src/androidMain/res/values/strings.xml new file mode 100644 index 00000000..5e8b1baf --- /dev/null +++ b/sample/molecule/composeApp/src/androidMain/res/values/strings.xml @@ -0,0 +1,3 @@ + + molecule-sample + \ No newline at end of file diff --git a/sample/molecule/composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml b/sample/molecule/composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml new file mode 100644 index 00000000..c0bcfb28 --- /dev/null +++ b/sample/molecule/composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml @@ -0,0 +1,36 @@ + + + + + + + + \ No newline at end of file diff --git a/sample/molecule/src/commonMain/kotlin/moe/tlaster/precompose/molecule/sample/App.kt b/sample/molecule/composeApp/src/commonMain/kotlin/moe/tlaster/precompose/molecule/sample/App.kt similarity index 100% rename from sample/molecule/src/commonMain/kotlin/moe/tlaster/precompose/molecule/sample/App.kt rename to sample/molecule/composeApp/src/commonMain/kotlin/moe/tlaster/precompose/molecule/sample/App.kt diff --git a/sample/molecule/composeApp/src/iosMain/kotlin/moe/tlaster/precompose/molecule/sample/MainViewController.kt b/sample/molecule/composeApp/src/iosMain/kotlin/moe/tlaster/precompose/molecule/sample/MainViewController.kt new file mode 100644 index 00000000..a87d5a56 --- /dev/null +++ b/sample/molecule/composeApp/src/iosMain/kotlin/moe/tlaster/precompose/molecule/sample/MainViewController.kt @@ -0,0 +1,5 @@ +package moe.tlaster.precompose.molecule.sample + +import androidx.compose.ui.window.ComposeUIViewController + +fun MainViewController() = ComposeUIViewController { App() } diff --git a/sample/molecule/composeApp/src/jvmMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt b/sample/molecule/composeApp/src/jvmMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt new file mode 100644 index 00000000..6628e9a4 --- /dev/null +++ b/sample/molecule/composeApp/src/jvmMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt @@ -0,0 +1,13 @@ +package moe.tlaster.precompose.molecule.sample + +import androidx.compose.ui.window.Window +import androidx.compose.ui.window.application + +fun main() = application { + Window( + onCloseRequest = ::exitApplication, + title = "molecule-sample", + ) { + App() + } +} diff --git a/sample/molecule/src/wasmJsMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt b/sample/molecule/composeApp/src/wasmJsMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt similarity index 100% rename from sample/molecule/src/wasmJsMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt rename to sample/molecule/composeApp/src/wasmJsMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt diff --git a/sample/molecule/src/wasmJsMain/resources/index.html b/sample/molecule/composeApp/src/wasmJsMain/resources/index.html similarity index 89% rename from sample/molecule/src/wasmJsMain/resources/index.html rename to sample/molecule/composeApp/src/wasmJsMain/resources/index.html index a8a4240c..9982f142 100644 --- a/sample/molecule/src/wasmJsMain/resources/index.html +++ b/sample/molecule/composeApp/src/wasmJsMain/resources/index.html @@ -3,7 +3,7 @@ - molecule + molecule-sample diff --git a/sample/molecule/src/wasmJsMain/resources/styles.css b/sample/molecule/composeApp/src/wasmJsMain/resources/styles.css similarity index 100% rename from sample/molecule/src/wasmJsMain/resources/styles.css rename to sample/molecule/composeApp/src/wasmJsMain/resources/styles.css diff --git a/sample/molecule/iosApp/Configuration/Config.xcconfig b/sample/molecule/iosApp/Configuration/Config.xcconfig new file mode 100644 index 00000000..f04bc523 --- /dev/null +++ b/sample/molecule/iosApp/Configuration/Config.xcconfig @@ -0,0 +1,3 @@ +TEAM_ID= +BUNDLE_ID=moe.tlaster.precompose.molecule.sample.molecule-sample +APP_NAME=molecule-sample \ No newline at end of file diff --git a/sample/molecule/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/sample/molecule/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..ee7e3ca0 --- /dev/null +++ b/sample/molecule/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/sample/molecule/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/sample/molecule/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..8edf56e7 --- /dev/null +++ b/sample/molecule/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "app-icon-1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/sample/molecule/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png b/sample/molecule/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png new file mode 100644 index 00000000..53fc536f Binary files /dev/null and b/sample/molecule/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png differ diff --git a/sample/molecule/iosApp/iosApp/Assets.xcassets/Contents.json b/sample/molecule/iosApp/iosApp/Assets.xcassets/Contents.json new file mode 100644 index 00000000..4aa7c535 --- /dev/null +++ b/sample/molecule/iosApp/iosApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/sample/molecule/iosApp/iosApp/ContentView.swift b/sample/molecule/iosApp/iosApp/ContentView.swift new file mode 100644 index 00000000..3cd5c325 --- /dev/null +++ b/sample/molecule/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import UIKit +import SwiftUI +import ComposeApp + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + MainViewControllerKt.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/sample/molecule/iosApp/iosApp/Info.plist b/sample/molecule/iosApp/iosApp/Info.plist new file mode 100644 index 00000000..412e3781 --- /dev/null +++ b/sample/molecule/iosApp/iosApp/Info.plist @@ -0,0 +1,50 @@ + + + + + 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 + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/sample/molecule/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/sample/molecule/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..4aa7c535 --- /dev/null +++ b/sample/molecule/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/sample/molecule/iosApp/iosApp/iOSApp.swift b/sample/molecule/iosApp/iosApp/iOSApp.swift new file mode 100644 index 00000000..d83dca61 --- /dev/null +++ b/sample/molecule/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/sample/molecule/src/androidMain/AndroidManifest.xml b/sample/molecule/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 1307b6ed..00000000 --- a/sample/molecule/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - diff --git a/sample/molecule/src/jvmMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt b/sample/molecule/src/jvmMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt deleted file mode 100644 index 64b11fdf..00000000 --- a/sample/molecule/src/jvmMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt +++ /dev/null @@ -1,15 +0,0 @@ -package moe.tlaster.precompose.molecule.sample - -import androidx.compose.ui.window.Window -import androidx.compose.ui.window.application - -fun main() { - application { - Window( - title = "PreCompose Molecule Sample", - onCloseRequest = ::exitApplication, - ) { - App() - } - } -} diff --git a/sample/molecule/src/macosMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt b/sample/molecule/src/macosMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt deleted file mode 100644 index 7853b675..00000000 --- a/sample/molecule/src/macosMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt +++ /dev/null @@ -1,13 +0,0 @@ -package moe.tlaster.precompose.molecule.sample - -import androidx.compose.ui.window.Window -import platform.AppKit.NSApp - -fun main() { - Window( - "PreCompose Molecule Sample", - ) { - App() - } - NSApp?.run() -} diff --git a/sample/molecule/src/uikitMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt b/sample/molecule/src/uikitMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt deleted file mode 100644 index 25ddb38f..00000000 --- a/sample/molecule/src/uikitMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt +++ /dev/null @@ -1,49 +0,0 @@ -package moe.tlaster.precompose.molecule.sample - -import androidx.compose.ui.window.ComposeUIViewController -import kotlinx.cinterop.BetaInteropApi -import kotlinx.cinterop.ExperimentalForeignApi -import kotlinx.cinterop.autoreleasepool -import kotlinx.cinterop.cstr -import kotlinx.cinterop.memScoped -import kotlinx.cinterop.toCValues -import platform.Foundation.NSStringFromClass -import platform.UIKit.UIApplication -import platform.UIKit.UIApplicationDelegateProtocol -import platform.UIKit.UIApplicationDelegateProtocolMeta -import platform.UIKit.UIApplicationMain -import platform.UIKit.UIResponder -import platform.UIKit.UIResponderMeta -import platform.UIKit.UIScreen -import platform.UIKit.UIWindow - -@OptIn(ExperimentalForeignApi::class, BetaInteropApi::class) -fun main() { - val args = emptyArray() - memScoped { - val argc = args.size + 1 - val argv = (arrayOf("skikoApp") + args).map { it.cstr.ptr }.toCValues() - autoreleasepool { - UIApplicationMain(argc, argv, null, NSStringFromClass(SkikoAppDelegate)) - } - } -} - -@BetaInteropApi -class SkikoAppDelegate : UIResponder, UIApplicationDelegateProtocol { - companion object : UIResponderMeta(), UIApplicationDelegateProtocolMeta - - @OverrideInit - constructor() : super() - - @OptIn(ExperimentalForeignApi::class) - override fun application(application: UIApplication, didFinishLaunchingWithOptions: Map?): Boolean { - window = UIWindow(frame = UIScreen.mainScreen.bounds).apply { - rootViewController = ComposeUIViewController { - App() - } - makeKeyAndVisible() - } - return true - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index 2e0e6b7c..db5d77a0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -30,4 +30,4 @@ include(":sample:todo:common") include(":sample:todo:ios") include(":sample:todo:macos") include(":sample:todo:js") -include(":sample:molecule") +include(":sample:molecule:composeApp")