'What does a forward slash before a variable name do in Xcode + Swift?

In an Xcode project, using the Swift language, I've seen some lines of code use a forward slash just before a variable. For example:

func printSomething(something: String) {
    print(/something)
}

printSomething(something: "This is something")

Which gives the same output as if it didn't have the forward slash:

This is something

However, when trying to compile this outside of Xcode, it fails with

error: '/' is not a prefix unary operator

So I guess it is something particular to Xcode or iOS.

What does this forward slash do? I can't tell the difference and can't seem to find any resources on this.



Solution 1:[1]

Are you sure you're not misremembering, and it was actually a \ you were seeing - in that case you would be referring to keypaths. These are a way of storing uninvoked references to properties, they refer to a property itself rather than to that property’s value.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alexander Simpson