In Swift I can create a String variable such as this:
let s = "Hello\nMy name is Jack!"
My name is Jack!
let sRaw = s.raw
Hello\nMy name is Jack!
The newline is the "raw character" contained in the string.
How exactly you formed the string (in this case from a string literal with an escape sequence in source code) is not retained (it is only available in the source code, but not preserved in the resulting program). It would look exactly the same if you read it from a file, a database, the concatenation of multiple literals, a multi-line literal, a numeric escape sequence, etc.
If you want to print newline as
\n you have to convert it back (by doing text replacement) -- but again, you don't know if the string was really created from such a literal.