It’s About Time! Quality Coding Embraces Swift 

 June 28, 2016

by Jon Reid


You spoke. The world is shifting. It’s time for Quality Coding to go Swift!

Better late than never.

Code snippet sample

Improve your test writing “Flow.”

Sign up to get my test-oriented code snippets.

I want to thank everyone who participated in my 2016 reader survey. Your number one request was clear: “More Swift”.

When Apple first announced Swift, my Twitter feed was filled with folks struggling with the basic tooling. I need to get stuff done, so I waited while the early adopters took the hard knocks. You paved the way. Thank you.

I have yet to work on a team that uses Swift for production code. But I watched Apple’s WWDC 2016 announcements with interest. I’m still playing catch-up on the sessions, but “Swift API Design Guidelines” was noteworthy. An entire session on clean, readable code, and how Swift 3 changes the experience… I’m in! I want that!

So let’s try this. I’m going to start a new version of the Marvel Browser—this time in Swift. I’ll give the Swift version higher priority than the Objective-C version. This will have the following effects:

  • My posting frequency may decrease. I’ve been trying to keep up a weekly cadence this year. Expect bumps in the rhythm.
  • I’ll need your help! My initial attempts at Swift will come from an Objective-C mind. As I write stuff, please don’t hesitate to suggest ways that are more Swifty.

Do you have any tips or suggestions for me as I start? I value your input, so please leave a comment below.

Jon Reid

About the author

Programming was fun when I was a kid. But working in Silicon Valley, I saw poor code lead to fear, with real human costs. Looking for ways to make my life better, I learned about Extreme Programming, including unit testing, test-driven development (TDD), and refactoring. Programming became fun again! I've now been doing TDD in Apple environments for 20 years. I'm committed to software crafting as a discipline, hoping we can all reach greater effectiveness and joy. Now a coach with Industrial Logic!

  • Jon,
    This is great news! I’m an old Objc developer too, and I just decided a while back to throw myself into Swift and I have to say it’s been a blast. I can’t wait to see how you bring some of your insights on clean code to Swift.

  • Only words – “at last”!;) Can’t wait to all these stuff in swift way. In our team we start swift adoption by writing tests on swift, so it’s highly relevant news.

  • Good news!
    One thing I realised is that mocking is way more verbose. There aren’t any usable mocking frameworks yet. So you will have to create your own mocks and stubs. At least that is what I’m doing.

  • You ask for tips about starting to do TDD with Swift. I have done a TDD workshop using Swift 4 month ago. At this workshop a simple Todo list app was created from scratch. As preparation I have implemented the app step by step and I have put the code on github:

    I have also added a tag for every step, so that it is possible to reproduce the progress.

    With this example you can investigate how I do TDD in my projects using swift.

  • How about just writing tests in Java & then using j2objc to bring this code into ObjC?

    Too many languages & environments, not enough lifetime.

    You’d end up writing some java versions of the objc apis…. but that is good software design, no? There is another tool, though it is paid, that’ll convert ObjC -> java that might speed this up.

    Just an idea.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}