Migrate KMP to swift module export

This commit is contained in:
2025-10-21 11:47:47 -03:00
parent 13babb6193
commit 76db29ae77
4 changed files with 16 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.swiftexport.ExperimentalSwiftExportDsl
plugins { plugins {
alias(libs.plugins.androidApplication) alias(libs.plugins.androidApplication)
@@ -24,6 +25,17 @@ kotlin {
} }
} }
@OptIn(ExperimentalSwiftExportDsl::class)
swiftExport {
moduleName = "ComposeApp"
flattenPackage = "dev.carlosmartino.template"
export(project(":features:common")) {
moduleName = "CommonFeature"
flattenPackage = "dev.carlosmartino.template.common"
}
}
sourceSets { sourceSets {
androidMain.dependencies { androidMain.dependencies {
implementation(compose.preview) implementation(compose.preview)

View File

@@ -152,7 +152,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/../..\"\n./gradlew :app:composeApp:embedAndSignAppleFrameworkForXcode\n"; shellScript = "cd \"$SRCROOT/../..\"\n./gradlew :app:composeApp:embedSwiftExportForXcode\n";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */

View File

@@ -4,7 +4,7 @@ import ComposeApp
struct ComposeView: UIViewControllerRepresentable { struct ComposeView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController { func makeUIViewController(context: Context) -> UIViewController {
MainViewControllerKt.MainViewController() MainViewController()
} }
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
@@ -12,10 +12,6 @@ struct ComposeView: UIViewControllerRepresentable {
struct ContentView: View { struct ContentView: View {
var body: some View { var body: some View {
ComposeView() ComposeView().ignoresSafeArea()
.ignoresSafeArea()
} }
} }

View File

@@ -5,7 +5,7 @@ android-minSdk = "26"
android-targetSdk = "36" android-targetSdk = "36"
# Platform specific versions # Platform specific versions
agp = "8.13.0" agp = "8.13.0"
kotlin = "2.2.20" kotlin = "2.3.0-Beta1"
androidx-activity = "1.11.0" androidx-activity = "1.11.0"
androidx-core = "1.17.0" androidx-core = "1.17.0"
androidx-espresso = "3.7.0" androidx-espresso = "3.7.0"