Thread
#multiplatform
    v

    Vivek Modi

    4 months ago
    hey I see in gradle file I have kotlin block inside that I have
    getting/creating
    . I know this property using delagate property. Can someone explain me what is use of
    creating
    and
    getting
    and when to use them. I am totally confused.
    val androidMain by getting {
                dependencies {
                    implementation("androidx.core:core-ktx:1.3.2")
                }
            }
    
    val iosMain by creating {
                dependsOn(commonMain)
                iosX64Main.dependsOn(this)
                iosArm64Main.dependsOn(this)
                iosSimulatorArm64Main.dependsOn(this)
            }
    
      val iosMain by creating { dependsOn(commonMain) }
            val iosX64Main by getting { dependsOn(iosMain) }
            val iosArm64Main by getting { dependsOn(iosMain) }
    Paul Woitaschek

    Paul Woitaschek

    4 months ago
    It is a property delegate that uses the name of the variable to create / locate the source set
    v

    Vivek Modi

    4 months ago
    Can you tell me what is difference in these two
    val iosMain by creating { dependsOn(commonMain) }
    vs
    val iosX64Main by getting { dependsOn(iosMain) }
    ?
    iosMain
    is using
    creating
    and
    iosX64Main
    is
    getting
    . It little bit confusion.
    Paul Woitaschek

    Paul Woitaschek

    4 months ago
    It's about connecting source sets
    iosMain is created
    Then it depends on all the other iosXYZMains that already exist. Therefore the use the getting
    v

    Vivek Modi

    4 months ago
    Ok got it thanks