Swift print() with color

Question

I am using XCode 8 and the code

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.

PS: I don't want to use libraries


Show source
| swift   | debugging   | logging   | colors   | printing   2016-11-14 08:11 0 Answers

Answers ( 0 )

◀ Go back