Hello, As part of a Kotlin Multiplatform (KMP) pro...
# multiplatform
i
Hello, As part of a Kotlin Multiplatform (KMP) project with a Clean Architecture, how do you manage the configuration of the environments (dev, preprod and prod)? I have different APIs depending on the environment.
m
https://github.com/yshrsmz/BuildKonfig this library check it very helpfully
i
But how can I choose their environment side Xcode ?
m
sorry i have no idea ios side
s
I've a setup with buildkonfig library, with multiple variants. Following are the rough steps for the setup. 1. Create flavour dimensions in Android, let's say dev and prod 2. Create build configurations in Xcode, which must be similar to Android's flavour dimensions. 3. Expose the current Xcode configuration via user-defined settings. The Xcode sets each of the user-defined settings as an env variable. 4. In the common module, you can get the current variant via checking the android's current build task or if that is not present (when you are building for ios) you can get that via the env variable
Screenshot 2024-07-09 at 21.21.14.png,Screenshot 2024-07-09 at 21.22.11.png,Screenshot 2024-07-09 at 21.23.00.png
Common module
i
@Spoudel347 You don't have a github repo with these configs ?
s
Unfortunately no, I've been thinking about writing a guide (and a sample) about it but haven't gotten to it.