First, the default parameters: they are built-in keywords that return the current function (1), file (2) and line number (3). You can pass in any String, but the purpose of these is to print the current location of customPrint.

Next, we make sure no printing happens in production (2), because it (slightly) slows down the app, and clutters the system console with our logs.

Finally, we will do a bit of extra work now, so we can be lazy at later times: we create a dummy, fileprivate struct (10), that acts as a flag inside our maincustomPrint (5). This way we are able to call customPrint without any parameters (8, 11), but still get the correct location (5, 6, 9, 10).

Sadly, I didn't find any better way to differentiate between customPrint() and customPrint(x). While it wouldn't have been hard to just call customPrint(""), I hated the dangling - (7 with an empty String), and I'm also that lazy sometimes ¯\_(ツ)_/¯.