Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
How to use NSLog and print only for debugging? http://swiftiostutorials.com/use-nslog-debugging/
/// Writes the textual representations of `items` most suitable for
/// debugging, separated by `separator` and terminated by
/// `terminator`, into the standard output.
///
/// The textual representations are obtained for each `item` via
/// the expression `String(reflecting: item)`.
///
/// - Note: To print without a trailing newline, pass `terminator: ""`
///
/// - SeeAlso: `print`, `Streamable`, `CustomStringConvertible`,
/// `CustomDebugStringConvertible`
public func debugPrint(items: Any..., separator: String = default, terminator: String = default)
// Swift 3
import Foundation
func releasePrint(_ object: Any) {
Swift.print(object)
}
func print(_ object: Any) {
#if DEBUG
Swift.print(object)
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment