The following assumes a Swift environment using the LLVM compiler.
GIVEN I have the following:
var isDebug: Bool {
#if DEBUG
return true
#else
return false
#endif
}
WHEN the environment flag DEBUG is NOT set
AND the following code is compiled
var secret = ""
if isDebug {
secret = "abc123"
}
print(secret)
THEN
Will the compiled binary contain the string "abc123" somewhere within it or will the compiler remove it?
Is this just as "safe" as using:
var secret = ""
#if DEBUG
secret = "abc123"
#endif
print(secret)