Active Compilation Conditions for Xcode
Previously, declaring conditional compilation flags was done in the OTHER_SWIFT_FLAGS
build setting. The tricky part when adding a flag was remembering to prepend -D
like -DBETA
. Forgetting the flag could lead to unexpected results or time wasted to debugging.
Enter Active Compilation Conditions.
Active Compilation Conditions
As of Xcode 8, we have the new SWIFT_ACTIVE_COMPILATION_CONDITIONS
build setting which allows us to define our flags without the need to prefix them. Under the hood, each element is passed to swiftc
prefixed with -D
👏🏽! This matches the behavior we had with Objective-C and Preprocessor Macros.
Usage
Regardless of which setting you choose to add it to, using the flag in your Swift project is the same:
No comments yet. Share on Mastodon and see your comment or write a post on your blog if you support Webmentions
No reposts yet. Share on Mastodon and see your repost or write a post on your blog if you support Webmentions
No likes yet. Share on Mastodon and see your like or write a post on your blog if you support Webmentions
No bookmarks yet. Share on Mastodon and see your bookmark or write a post on your blog if you support Webmentions
Powered by Webmentions