Skip to content

Three double quotes '"""' in Swift

Platform Language License

Indentation at the start of each quoted line is removed, as long as it matches the indentation of the closing quote.

Example:

let quotation = """Even though there's whitespace to the left,
the actual lines aren't indented.
Except for this line.

Double quotes (") can appear without being escaped.
I still have \(apples + oranges) pieces of fruit."""

You can only use them with Xcode 9 above, Swift 4 above.

Reference:

Platform

Let's grow together 🌱

Cheers 🍻