2019-08-23
print() to console log with color
stackoverflow
Question

The code is:

let redColor = "\u{001B}[0;31m"
var message = "Some Message"
print(redColor + message)  //This doesnt work
print("\(redColor)\(message)" //This also doesnt work

and the output would look like this:

[0;31mSome Message

I've also read this post: Color ouput with Swift command line tool, and it doesn't seem to work.

I don't want to use libraries.

Answer
1

Nowadays, Xcode debugging console doesn't support coloring.

print() to console log with color
See more ...