Hi, is there a way to conditionally compile blocks...
# kotlin-native
s
Hi, is there a way to conditionally compile blocks of code ? For instance :
Copy code
#if os(iOS)
    // My iOS-only code
#endif
or
Copy code
#if platform(framework)
    // My framework-only code
#endif
o
Just put your code into separate files and select different files when compiling for different targets, see, for example: https://github.com/JetBrains/kotlinconf-spinner/blob/b9d4550d7611e732f2c54a54a3feeb4d4e1d5f7b/kotlin-native/samples/fullstack/common/build.gradle#L6
👍 4
😞 1
b
I wish… 😕