https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
b

Bradleycorn

11/21/2023, 4:05 PM
Hi everyone, When using the
native.cocoapods
plugin, we can set the native build type based on the Xcode configuration, like this:
Copy code
xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
I’m wondering if the build type is set before or after the
cocoapods.framework
block is setup. What I’m trying to do is setup the linking based on the build type (dynamic linking for debug builds, static linking for release builds). Wondering if something like this would work???
Copy code
cocoapods {
        // Required properties here...

        // Maps custom Xcode configuration to NativeBuildType
        xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
        xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE

        framework {
            // Required properties here ...

            isStatic = (buildType == RELEASE)
        }

}
a

a-dd

11/21/2023, 7:09 PM
You can try smth like this:
isStatic = xcodeConfigurationToNativeBuildType[property(KotlinCocoapodsPlugin.CONFIGURATION_PROPERTY)] == NativeBuildType.RELEASE
Not sure I’d recommend such configuration though 😅