Hi All, I’m building a multiplatform library, and ...
# multiplatform
b
Hi All, I’m building a multiplatform library, and one of the targets is native (ios). When configuring the native artifacts (in my case, with cocoapods), I know can use
xcodeConfigurationToNativeBuildType
to map configurations that might be in an XCode project to a native build type (debug or release), like this:
Copy code
xcodeConfigurationToNativeBuildType["CUSTOM_BUILD_TYPE"] = NativeBuildType.DEBUG
But that requires that in my Kotlin project, I know all of the different configurations that any consuming xcode project might use when using my library. That’s impossible to know ahead of time. Is there some way that I can “calculate” the Native Build Type based on the configuration that is passed in? I thought of using mutable map’s
compute
or
computeIfAbsent
methods, but they still require a parameter with a “pre-known” configuration value. What I’m really looking for is something that would work kind of like this:
Copy code
xcodeConfigurationToNativeBuildType.compute { inputConfig ->
    return if (inputConfig.contains("CUSTOM")) {
        NativeBuildType.DEBUG
    } else {
        NativeBuildType.RELEASE
    }
}
Is there a way to achieve something like this?
or maybe some way to convert the configuration string on the Xcode side before it gets to gradle/kotlin compiler?