Hi everyone I need to add new modules (`iosArm64Ma...
# ios
h
Hi everyone I need to add new modules (
iosArm64Main
,
iosX64Main
,
iosSimulatorArm64Main
, etc) to an existing projects? In my current project I have only
iosMain
but I would like to have other modules as well because otherwise I am not able to build my cocoapod dependency and have error like this Undefined symbols for architecture _*x86_64*_:. ld: symbol(s) not found for architecture _*x86_64*_
1. This is the current module list structure.
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/KMM-Shared-Library.iml" filepath="$PROJECT_DIR$/.idea/modules/KMM-Shared-Library.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/KMM-Shared-Library.buildSrc.main.iml" filepath="$PROJECT_DIR$/.idea/modules/KMM-Shared-Library.buildSrc.main.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/KMM-Shared-Library.buildSrc.test.iml" filepath="$PROJECT_DIR$/.idea/modules/KMM-Shared-Library.buildSrc.test.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.androidTest.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.androidTest.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.commonMain.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.commonMain.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.commonTest.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.commonTest.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.iosMain.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.iosMain.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.iosTest.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.iosTest.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.main.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.main.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.unitTest.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/KMM-Shared-Library.shared.unitTest.iml" />
    </modules>
  </component>
</project>
But I want to achieve this list:
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/MyApplicationDDLogSample.iml" filepath="$PROJECT_DIR$/.idea/modules/MyApplicationDDLogSample.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iml" />
      ..
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.commonMain.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.commonMain.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.commonTest.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.commonTest.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosArm64Main.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosArm64Main.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosArm64Test.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosArm64Test.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosMain.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosMain.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosSimulatorArm64Main.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosSimulatorArm64Main.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosSimulatorArm64Test.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosSimulatorArm64Test.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosTest.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosTest.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosX64Main.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosX64Main.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosX64Test.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.iosX64Test.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.main.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.main.iml" />
      <module fileurl="file://$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.unitTest.iml" filepath="$PROJECT_DIR$/.idea/modules/shared/MyApplicationDDLogSample.shared.unitTest.iml" />
    </modules>
  </component>
</project>
2. I would like to add those modules like this in build gradle file,
Copy code
sourceSets {
        all {
            languageSettings.apply {
                optIn("kotlin.RequiresOptIn")
                optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
            }
        }
        val commonMain by getting
        val androidMain by getting
        val iosX64Main by getting
        val iosMain by creating {
            dependsOn(commonMain)
            iosX64Main.dependsOn(this)
        }
    }
But then I have an error like, KotlinSourceSet with name 'iosX64Main' not found.
r
Build targets and source sets are different things, you need to add build targets
h
Hi @ribesg Am I able to add build targets in Android Studio? Or you are talking about target in Xcode?
r
See the difference between targets and source sets in the DSL documentation https://kotlinlang.org/docs/multiplatform-dsl-reference.html#targets