For simply printing folder/file path:
let fileName = "myFile.jpg"
let fullPath = "folder/\(fileName)"
print(fullPath)
/* Prints: folder/myFile.jpg */
let fileName = "myFile.jpg"
let fullPath = "folder\\\(fileName)"
print(fullPath)
/* Prints: folder\myFile.jpg */
Regarding string interpolation and escape characters in Swift, see Swift Language Guide - Strings and Characters:
String interpolation
String interpolation is a way to construct a new String value from a
mix of constants, variables, literals, and expressions by including
their values inside a string literal. Each item that you insert into
the string literal is wrapped in a pair of parentheses, prefixed by a
backslash:
let multiplier = 3
let message = "\(multiplier) times 2.5 is \(Double(multiplier) * 2.5)"
In the example above, the value of multiplier is inserted into a
string literal as \(multiplier)
.
...
Special Characters in String Literals
String literals can include the following special characters:
- The escaped special characters \0 (null character),
\\
(backslash), \t (horizontal tab), \n (line feed), \r (carriage return), \" (double
quote) and \' (single quote)
...
As vadian writes, however, methods to handle path components are preferable, see e.g.