This website does not display correctly in Internet Explorer 8 and older browsers. The commenting system does not work either in these browsers. Sorry.

The Swift effect

17 January 2018

Posted in Coding

In June 2014, at its annual developer conference, Apple announced that they had created a new programming language, named Swift, to replace the ageing Objective-C as the preferred language for writing applications for Apple devices.

I remember this well because also in 2014 I had decided to revamp the API for OCMock, a testing framework for Objective-C that I have been maintaining for a long time. Most of the work on the framework was done in April/May, and the Swift announcement came just days before the release of the new version of OCMock.

Immediately, I wondered what impact of Apple’s announcement would have on Objective-C and, in turn, on OCMock. Given Apple’s messaging around this, it was clear that most developers would eventually move to Swift. But how many? And how quickly?

Swift’s popularity and the use of OCMock

A number of reports track the relative popularity of programming languages. This includes the TIOBE Index and Redmonk Rankings. They show that since its first release in October 2014 Swift has been gaining popularity. In TIOBE’s January 2018 report Swift has even overtaken Objective-C (positions 12 and 16 respectively).

With Swift becoming more and more popular an obvious assumption is that more and more development for Apple’s ecosystem is happening in Swift instead of Objective-C. And therefore the use of OCMock should decline.

Of course, I would not expect that existing pieces of software written in Objective-C are suddenly all being ported to Swift but I think it is fair to assume that fewer new software projects are being started in Objective-C and fewer people pick up OCMock. So, a hypothesis is that traffic to the ocmock.org website, which hosts all the documentation, should decrease. Let’s have a look.

Traffic to ocmock.org

The graph below shows page views on ocmock.org per quarter for the last five years. The data comes from statcounter.com and is collected with a small piece of JavaScript on the web pages. This means the numbers are likely representing real people looking at the pages and they should not be skewed too much by robots and other automated traffic. They are impacted by certain ad-blockers and the browsers’ do-not-track flag, but that should not matter for our purposes.

We can see that in Q4 2014, just following the release of the first version of Swift, traffic drops slightly in comparison to the previous quarter. In the following two quarters, though, traffic rebounds and reaches the highest levels recorded. A year after the release of Swift traffic is down slightly in comparison to the same period a year earlier, but it is still higher than at any point in 2013.

The big decline starts in the second half 2016 and continues throughout 2017. Now traffic is less than half of what it was just before Swift was released. Given that no major new mocking framework has been released for Objective-C (at least not that I am aware of), the traffic numbers show that, indeed, the Apple development community is switching to Swift in numbers.

There is still substantial use of Objective-C, though, and it’s going to be interesting to see where the long-tail starts, especially because both languages are mostly used for mobile apps, which generally aren’t actively worked on for a long time.