GitHub data shows developers are turning to Swift

Apple's Craig Federighi introduces the Swift programming language at WWDC 2014
Credit: YouTube/Apple

Only six weeks after its release, Apple’s new programming language appears to already be on its way to replacing Objective-C

It’s been about six weeks now since Apple released Swift, its new language for iOS and OS X development, which is meant to eventually replace Objective-C. Not surprisingly, since its high visibility debut at Apple’s Worldwide Developers Conference, Swift has already attracted a noticeable amount of interest from developers. It debuted this month at number 16 on the TIOBE Programming Community index, which is based on search web results, and at number 10 on the PYPL Popularity of Programming Language index, which is based on searches for programming language tutorials.

Clearly and, again, not surprisingly, Swift is off to a strong start in gaining a foothold with developers. Since the TIOBE and PYPL indices are based on what people are searching for, I wanted to take a look at how much actual Swift code had been written in the first few weeks. Are all of those searches resulting in developers actually learning and writing applications using Swift? To find out, I dug into GitHub Archive data using Google’s BigQuery.

First, I looked at the number of non-forked GitHub repositories created by programming language from June 1 through July 15, 2014 (see Note 1 below for the how I generated that list). Swift was ranked #15 in that list, with just over 2,600 new repositories created. This jibes with Swift’s position on TIOBE. Developers are not only searching for information on Swift, they’re actually starting to use it to write code, to a noticeable degree.

Next, I wanted to look at the adoption of Swift over time since it was released. Did developers just try Swift in those first days, then go back to their old habits? Or is Swift code steadily gaining a foothold? To find out, I looked at the number of non-forked Swift GitHub repositories created each day since its release. Here’s what I found:

number of non-forked Swift GitHub repositories created daily, 6/1-7/15/14 ITworld/Phil Johnson

See Note 2 below for how I generated these data.

We definitely see a spike in the first couple of days after Swift was released; 170 Swift GitHub repositories were created on June 4, two days after its official release. We see the initial spike settle into a more steady state after about two weeks. Since its release, developers have created, on average, about 60 Swift repositories on GitHub per day, and about 47 per day since June 19 when the initial spike seemed to calm down. Swift has seemed to already established a firm foothold among developers

Finally, since Swift is meant to replace Objective-C, I wanted to get a sense of whether developers are actually switching from Objective-C to Swift, or whether the new Swift code being created was in addition to what iOS developers are doing with their old standard. To get a sense of that, I looked at the number of (again, non-forked) Objective-C GitHub repositories created since Swift was released; for comparsion purposes, I also looked at the number of Objective-C repos created for the five months before the release of Swift. 

From the beginning of January through the end of May, developers created about 294 new Objective-C repositories per day on GitHub. Since Swift was released in early June, that average has dropped to about 246 repos per day. That drop of 48 repos per day is pretty close to the average number of new Swift repositories created per day since its release and initial spike in interest. This suggests that developers have indeed already begun the switch from Objective-C to Swift.

Of course, six weeks is a short time frame, and we’re still in Swift’s early days. Plus, we can’t really draw any conclusions of causality in the drop in new Objective-C repositories from these data. For example, the number of Objective-C repositories created in June and July could simply be down because it's summer time and people are going on vacation. Time will more clearly tell if these trends are indicative of a real switch (pardon the pun) by programmers.

But, regardless, it’s clear that, for now, at least, Swift is quickly making an impact in the developer world. Insert your own “swiftly” joke here...


1. To generate the number of non-forked GitHub repositories created by programming language from June 1 through July 15, 2014, I ran the following query in Google BigQuery against project "githubarchive":

SELECT repository_language, count(*)
FROM [githubarchive:github.timeline]
WHERE repository_fork == "false"
AND type == "CreateEvent"
AND PARSE_UTC_USEC(repository_created_at) >= PARSE_UTC_USEC('2014-06-01 00:00:00')
AND PARSE_UTC_USEC(repository_created_at) < PARSE_UTC_USEC('2014-07-16 00:00:00')
GROUP BY repository_language

2. To generate the data in the chart Number of Non-Forked Swift GitHub Repositories Created Per Day, 6/1/14 through 7/15/14 above, I ran the following query against the GitHub Archive:

SELECT date(repository_created_at) created_date, count(*) count
FROM [githubarchive:github.timeline]
WHERE repository_fork == "false"
AND type == "CreateEvent"
AND repository_language == "Swift"
AND PARSE_UTC_USEC(repository_created_at) >= PARSE_UTC_USEC('2014-06-01 00:00:00')

Read more of Phil Johnson's #Tech blog and follow the latest IT news at ITworld. Follow Phil on Twitter at @itwphiljohnson. For the latest IT news, analysis and how-tos, follow ITworld on Twitter and Facebook.

ITWorld DealPost: The best in tech deals and discounts.
You Might Like