You spoke. The world is shifting. It’s time for Quality Coding to go Swift!
Better late than never.
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.
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.
looking forward to see your approach to swift :)
If I may suggest something, go with Swift 3.0, there’s no reason to write almost-legacy 2.2 code version now.
Good idea — I’ll jump in to the latest. Thanks, Paweł.
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.
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.
Yes, so far Swift seems like, “Hurray, I can type much less production code! Oh, but I have to type a lot more test code.”
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.
Woot, thanks, René!
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.