Thursday, February 9, 2017

Getting to Swift 3 at Airbnb


We have dozens of modules and several 3rd-party libraries written in Swift, comprising thousands of files and hundreds of thousands of lines of code. As if the size of this Swift codebase weren’t enough of a challenge, the fact that Swift 2 and Swift 3 modules cannot import each other further complicated the migration process. Even correct Swift 3 code that imports Swift 2 libraries will not compile. This incompatibility made it difficult to parallelize code conversion.


While we were excited about Swift 3’s new language features, we also wanted to understand how the update would affect our end users and overall developer experience. We closely monitored Swift 3’s impact on release IPA size and debug build time, since these have been our two largest Swift pain points so far. Unfortunately, after experimenting with different optimization settings, Swift 3 still scored marginally worse on both metrics.


A number of things have changed, but most importantly the parameter in completionBlock has changed from an implicitly unwrapped optional to an optional. This can break its usage within the blocks.


Optional protocol methods are easy to accidentally miss during a Swift 3 conversion.

3 Comments RSS · Twitter

It amazes me how developers have migrated to Apple's new language before it is fully stable. The API churn because of language changes must be a large burden. Are the gains worth that increased friction?

@Kevin I don’t think anyone was expecting this much API churn, but the end result is a huge improvement.

[…] Previously: Getting to Swift 3 at Airbnb. […]

Leave a Comment