Skyscanner Feb 9, 2016

Transitioning From Objective C to Swift in 4 Steps

Article Summary

Gergely Orosz from Skyscanner reveals how his team went from 0% to 100% Swift adoption in just 8 months—without rewriting a single line of working Objective-C code. Here's their battle-tested playbook.

Skyscanner started building TravelPro in Objective-C in March 2015, then pivoted to Swift 2.0 months later. By November 2015, every new feature was Swift-only. This article breaks down their incremental migration strategy that kept velocity high while modernizing a 65,000-line codebase.

Key Takeaways

Critical Insight

Skyscanner successfully transitioned to 100% Swift for new code by taking an incremental approach that improved architecture without the risk or cost of a full rewrite.

The team discovered that Swift's lack of mocking frameworks actually forced them to write better code than they ever did in Objective-C.

About This Article

Problem

When Skyscanner's team started writing Swift code, they ran into a problem. Swift didn't have mocking frameworks like OCMock, so unit testing was nearly impossible without first restructuring the implicit dependencies buried in their Objective-C codebase.

Solution

They adopted explicit dependency injection patterns and built custom mock objects instead. This forced them to decouple the code by implementing protocols that could be swapped in as test doubles.

Impact

The new Swift codebase ended up noticeably more loosely coupled than the old Objective-C code. Testing became easier, and they didn't have to sacrifice development speed to get there.