[swift-evolution] multi-line string literals

Brent Royal-Gordon brent at architechies.com
Mon Dec 14 16:10:18 CST 2015

> let x =
> "This is a proposal for a multiline literal String in Swift. This syntax solves a number of problems that
> "are common in other language's implementations of multiline Strings. This syntax is meant to be a
> "a generalization of regular Swift literal Strings, whereby a String is considered to begin with an open quote
> "and continue indefinitely until and including the end of the line (newline character),
> "or the String is closed with an ending quote.

Damn, why didn’t I think of that? It’s something like my email-style syntax, but based on regular English punctuation conventions instead of Internet ones. (I assume, incidentally, that there’s meant to be a closing quote on the last line, and it would be a syntax error if there weren’t.) 

You would want a “toggle line quoting” command in your editor, the same way many editors have a “toggle commenting” commandz. In Xcode, the natural keystroke would be Cmd-‘ or Cmd-", but that’s currently used for Jump to Next Issue/Jump to Previous Issue. If this feature is added, hopefully the Xcode guys see how much this needs that mapping.

Brent Royal-Gordon

More information about the swift-evolution mailing list