0

I am new to Swift and I was wondering if it is possible to print colored print statement in the console of Xcode..

Here's an example:

print("Hi my name is John Doe")

now I want to print this statement in red color, how would I do that?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Noob in Swift
  • 113
  • 1
  • 12
  • 5
    Possible duplicate of [Any way to print in color with NSLog?](https://stackoverflow.com/questions/9005769/any-way-to-print-in-color-with-nslog) – Bùi Đức Khánh Jul 04 '18 at 06:30

1 Answers1

4

That feature has been killed by Apple from Xcode 8. But you can use SwiftyBeaver to achieve it.

let log = SwiftyBeaver.self
let console = ConsoleDestination()
log.addDestination(console)

// default xcode colors
console.levelColor.verbose = " "
Cœur
  • 37,241
  • 25
  • 195
  • 267
Christian Abella
  • 5,747
  • 2
  • 30
  • 42