Multiline string literals don’t require quotes to be escapedBasics article available: Strings
One really nice benefit of Swift’s multiline string literals - even for single lines of text - is that they don’t require quotes to be escaped. Perfect when working with things like HTML, or when creating a custom description for an object.
let html = highlighter.highlight("Array<String>") XCTAssertEqual(html, """ <span class="type">Array</span><<span class="type">String</span>> """)
Support Swift by Sundell by checking out this sponsor:
Essential Developer: Learn the most up-to-date techniques and strategies for testing new and legacy Swift code in this free practical course for developers who want to become complete senior iOS developers. This virtual event includes lectures, mentoring sessions, and step-by-step instructions. Click to learn more.