Skip to content

Instantly share code, notes, and snippets.

@rsaenzi
Last active August 22, 2018 21:51
Show Gist options
  • Save rsaenzi/925abf3dbd28257778351d6000c14c8b to your computer and use it in GitHub Desktop.
Save rsaenzi/925abf3dbd28257778351d6000c14c8b to your computer and use it in GitHub Desktop.
To access default Xcode Build Configurations from code
//
// BuildConfiguration.swift
//
// Created by Rigoberto Sáenz Imbacuán (https://www.linkedin.com/in/rsaenzi/)
// Copyright © 2017 Rigoberto Sáenz Imbacuán. All rights reserved.
//
// For this to work, please add on "Other Swift Flags" the following keys:
// Key -D BUILD_CONFIG_DEBUG for Debug
// Key -D BUILD_CONFIG_RELEASE for Release
class BuildConfiguration {
static var current: BuildConfigurationOption {
#if BUILD_CONFIG_RELEASE
return .release
#endif
#if BUILD_CONFIG_DEBUG
return .debug
#endif
}
static var isNotRelease: Bool {
return current == .debug ? true : false
}
}
enum BuildConfigurationOption {
case release
case debug
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment