Take advantage of raw strings in Swift 5

Swift 5 comes with enhancement in string literals delimiters to support Raw Text.
swift5rawstrings

Let’s go with examples

Use of # delimiter

We can use # delimiter with start and end of the strings to use less escape sequences.

Output:
This is “Swift 4.x”.
This is “Swift 5.x”.

Use of variables with # delimiter

We can use variable with string like \#(variableName)

Output:
This is “Swift 4.x” with variable.
This is “Swift 5.x” with variable.

Multiline String with # delimiter

We can use # delimiter in multiline strings too.

Output:
This is
Swift 5.

Conclusion

Swift is getting more stable day by day!
If you have any questions, comments, suggestions or feedback then contact me onย Twitter @ashishkakkad8. I am retweeting many tips on my wall of twitter, you can follow me for updates of iOS.
Happy Coding ๐Ÿ™‚

References

Behind the Proposal โ€” SE-0200 Enhancing String Literals Delimiters to Support Raw Text