In an earlier recipe, we looked at some of the advanced operators that Swift offers on top of the common mathematical operators. In this recipe, we will look at how we can create our own operators, enabling very concisely expressive behaviors that feel like part of the language.
The custom operator we will create will be used to append the information in one value to the information in another value, producing a new value that contains the second value, followed by the first. The functionality we are looking to achieve is similar to the >> Unix command.
Getting ready
Let's understand how the Unix command, >>, works, and in this recipe, we will implement something similar in Swift using a custom operator.
Since macOS is Unix-based, we can provide Unix commands within Terminal. Open up the Terminal application on your Mac:

Type cd ~/Desktop and press Enter to move to the folder containing all the files and...