Posts from July 2018
Conditional Compilation, Part 2: Including and Excluding Source Files
In the previous post, we saw how the
SWIFT_ACTIVE_COMPILATION_CONDITIONS
build setting can inject values in to our .swift files that we can use to conditionalize code depending on our active SDK and/or architecture.Conditional Compilation, Part 1: Precise Feature Flags
When developing an app or a library, it’s pretty common that at least once in the course of development, you’ll need to conditionalize compilation of your code. Maybe you’ll be accounting for a bug in the operating system where things that don’t work quite the same on your device as they do on the simulator. Or perhaps you’ll want to simply exclude code from your simulator builds because the simulator simply doesn’t have that functionality (like invoking the camera).