<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">In many cases, it is necessary to include in the code very long strings, spanning multiple lines. An example could be to include a piece of JavaScript code, XML, HTML, JSON, etc. Currently, we include those strings between ““, which makes it impossible for the IDE to understand that we are “including” external code, potentially providing syntax highlighting, autocompletion, etc. Moreover, at the end of each line it is necessary to include a “\n” character and each “ character needs to be escaped.<div class=""><br class=""></div><div class="">My idea is to include a new operator to generate multiline strings, similar to PHP, in which you can write something like this:</div><div class=""><br class=""></div><div class=""><pre class="prettyprinted lang-php prettyprint" style="margin-top: 0px; padding: 5px; border: 0px; font-size: 13px; overflow: auto; width: auto; max-height: 600px; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; color: rgb(57, 51, 24); word-wrap: normal;"><code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;" class=""><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">$text </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">=</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);"><<<</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">EOT
</span><span class="typ" style="margin: 0px; padding: 0px; border: 0px; color: rgb(43, 145, 175);">Place</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);"> your text between the EOT</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">.</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);"> </span><span class="typ" style="margin: 0px; padding: 0px; border: 0px; color: rgb(43, 145, 175);">It</span><span class="str" style="margin: 0px; padding: 0px; border: 0px; color: rgb(128, 0, 0);">'s
the delimiter that ends the text
of your multiline string.
$var
EOT;</span></code></pre><div class="">This new feature could be highly beneficial, since it is increasingly common to mix multiple codes inside our own code. Furthermore, it could open the possibility to use Swift in Web environments in a friendlier manner (e.g. to generate HTML code faster, with syntax coloring, etc.). </div></div><div class=""><br class=""></div><div class="">- Carlos</div></body></html>