Swift Baby Steps
A few thoughts on our first step towards a Swift codebase.
When developers leave a team, you can lose valuable (and often obscure) knowledge of a mature codebase. When developers join a team, it’s a valuable opportunity for new ideas and fresh perspective.
A recent new recruit brought some much needed vigour to our team, giving us a firm shove in the direction of Swift. We needed a jolt to wake us from our warm, comfortable Objective-C routine.
We were in the fortunate position of rewriting a standalone piece of work, and were able to settle upon a compromise…
We decided to write tests in Swift.
- Maintain Velocity
-
Writing Swift tests, which are simpler than the functionality they’re verifying, allows us to start integrating Swift without a noticeable impact on velocity.
- Learn
-
Swift. Is. Fun. There’s a renewed enthusiasm when discussing the simplest of implementation details. Coding in Swift feels exciting!
- Build Confidence
-
Swift has many new concepts - even optionals can take a bit of unwrapping. Tests focussed around passing parameters and creating variables (or letting them be constants) allow us to focus on the fundamentals.
- Make Testing Sexy
-
97% of developers would rather write tests than new functionality. For the remaining 3%, Swift is a great way to ignite our enthusiasm for test writing.
- Forward Looking
- Integrating some Swift code provides a compelling, concrete motive for adding Swift keywords to Objective-C code (nullability, generics)
We’re only a few weeks into this Swift experiment, but so far so good!
Comments? Tweet me.