Is Apple Using Swift in iOS?
Apple has been actively evangelizing the use of Swift since it was announced at WWDC in 2014. In the Platforms State of the Union, Andreas Wendker wrapped up the introduction to the new language, saying,
So, we are, as you can probably imagine, really, really excited about Swift. We think it’s quickly going to become the programming language of choice for our own code as well as your apps.
Swift has quickly gained popularity among many third party developers, but what about for Apple’s own code? As of iOS 9.2, Calculator.app is the only place in the system that you’ll find any Swift. I expected to find at least a few other apps or frameworks that had incrementally adopted Swift for new code, but that doesn’t appear to be the case for now.
Calculator.app is actually almost “pure Swift” with only 2 of its 22 classes written in Objective-C. Just like third party apps that use Swift, Calculator.app has to bundle the Swift libraries it links to. There are no Swift libraries included with the OS because the ABI is not yet stable.
Apple also has a few apps that get distributed through the App Store rather than with the OS. What about those? In the same Platforms State of the Union talk that introduced Swift, it was announced that the WWDC app was updating to become the first public app to use the language:
… this afternoon, we’re updating the WWDC app, the app that you guys are using to get around here at the conference, with a version that uses Swift. So, this language is ready for you to use. It’s real.
While the WWDC app does in fact use Swift, it’s not as much as you might think. Out of 281 classes, only 6 are written in Swift. The Apple Store app is also using Swift for its watch app. That’s about all the production Swift I could find from Apple on iOS.
The choice to use Swift comes with some tradeoffs, and it appears that Apple has decided it’s generally not worth it for their apps or frameworks yet. However, there could be a very different story building for iOS 10. Since most of iOS is only dropped once per year, we’ll just have to wait and see in June.
WWDC quotes were taken from the excellent ASCIIwwdc.com
Update: Several people have noted that Dock on OS X has large portions written in Swift. To be clear, this post was focused on iOS and only investigated the frameworks and apps included in iOS 9.2. Apple’s Swift adoption in OS X could be significant, but I haven’t done the research.