AtelierClockwork

All in on Swift

February 19, 2016

And Totally in My Element

After about three months of working full time on a Swift project, I realized that having to go back to working in Objective-C as the primary language for a project would be a large mark in the “cons” column. It hasn’t made it to my list of languages that I actively dislike and try to avoid, but going back to Objective-C land feels clunky and unsafe all of the sudden.

Swift has its own issues, the compiler has gotten fairly stable, but there are still interesting issues like long build times, language volatility, immature tooling, and a lot of other things that I expect to improve over time. This means Swift isn’t a conservative choice to use in a project, but to me it has advantages that outweigh the drawbacks.

Part of it is that I enjoy the challenges that come with working in unknown territory. Having a new problem to solve, particularly one that doesn’t have an answer forthcoming with a few well placed Stack Overflow queries and Google searches, means a sense of satisfaction when I solve it.

The other big part is that I find that the code is just easier to read and understand, and it’s much easier to be sure you know what’s going on. Optionals, immutability, and strong typing mean predictable behavior. First class functions make working with blocks much easier. The most interesting one is that making good use of generics makes code much more re-usable while still allowing for safe types.