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.swiftexport.ExperimentalSwiftExportDsl
plugins {
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 {
androidMain.dependencies {
implementation(compose.preview)

View File

@@ -152,7 +152,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
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 */

View File

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