Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Created May 2, 2023 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sturdysturge/5bd8a5bfcaa103bfeb8bc8245ea02cee to your computer and use it in GitHub Desktop.
Save sturdysturge/5bd8a5bfcaa103bfeb8bc8245ea02cee to your computer and use it in GitHub Desktop.
import Foundation
import LocalConsole
var runningForPreviews: Bool {
#if targetEnvironment(simulator)
ProcessInfo.processInfo
.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1"
#else
return false
#endif
}
func print(_ items: Any..., separator: String = " ") {
let joined = items
.map { String(describing: $0) }
.joined(separator: separator)
if runningForPreviews {
console.print(joined)
} else {
Swift.print(joined)
}
}
var console: LCManager {
LocalConsole.LCManager.shared
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment