The Only Lars

Byte-sized adventures in software engineering

Swift’s Yolo Operator

I bought the domain and launched sort of as a joke maybe 6 months ago, but I still think it’s both funny and informative. It started as an office joke by me among the developers I worked with at Mutual Mobile, but it was really natural for people to reference the force-unwrapping pattern as a social anti-pattern. Half of me still thinks the name is stupid, but if it gets people to understand optionals and force-unwrapping, I’m all for perpetuating it. I was really just trying to drive home a “best-practice” (really just a practice) use of optionals and show how abused force-unwrapping had become.

As one of my co-workers, Eric Miller (@Xephos13), said: “It took all of like 9 seconds for most [everyone at work] to start saying it too”.

It’s like an infomercial for what I have seen in my past couple of years working with Swift (just picture half of the site in your head in black and white while reading it). Most people see optionals as a barrier to development, but once you truly think of them as an integral part of your development and architecture, you will write the safest code you’ve ever written. Just remember, this is just one guy’s opinion. Let me know what you think.

Please. Think of the kittens. Practice safe yolo.