I set up my application to either send debugging output to console or a log file. Now, I\'d like to decide with in the code whether
Why not using conditional compilation block in Swift?
#if DEBUG
// Do something.
#endif
Any objection?
You can define if you want a runtime constant
#if DEBUG
public let IS_RUNNING_IN_DEBUGGER: Bool = true
#else
public let IS_RUNNING_IN_DEBUGGER: Bool = false
#endif
The same approach can be used in Objc & more.