I have some UI elements I want to include in Debug only builds, is it possible to determine this at runtime?
I have some UI elements I want to include in Debug only builds, is it possible to determine this at runtime?
Use the :debug and :release annotations.
e.g. You could use these annotations to create a global boolean variable which indicates whether the app was built as debug or release.
(:debug) var isDebug as…
even better: do it a const. There's no reason to "waste" a variable for this.
- It's value is set during compile time and can't change. It's a classic const.
- when you use it…
Use the :debug and :release annotations.
e.g. You could use these annotations to create a global boolean variable which indicates whether the app was built as debug or release.
(:debug) var isDebug as Boolean = true;
(:release) var isDebug as Boolean = false;
even better: do it a const. There's no reason to "waste" a variable for this.
- It's value is set during compile time and can't change. It's a classic const.
- when you use it, it can save memory in the generated code:
if (IS_DEBUG) {
// ... code
}
The above code would be included in the production binary if you used a variable, while with the new compiler (since 7.x) it would be removed.