Skip to content

Instantly share code, notes, and snippets.

@olxios
Last active September 8, 2017 06:59
Show Gist options
  • Save olxios/f99f5b8cee80e0bc27db2d3704f849c3 to your computer and use it in GitHub Desktop.
Save olxios/f99f5b8cee80e0bc27db2d3704f849c3 to your computer and use it in GitHub Desktop.
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