Last active
September 8, 2017 06:59
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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