A roundup of Swift/Kotlin comparisons

by Joey deVilla on May 23, 2017

Spock and “Mirror Universe” Spock. (And yes, that’s the Kelvin Timeline Spock,
not the Prime Timeline Spock.)

With the recent announcement that Kotlin has become an official Android development language, it’s a good time to do some comparisons between Kotlin and Swift. I rounded up some interesting ones so you don’t have to go looking for them. Enjoy!

Swift is like Kotlin!

Swift is Like Kotlin is a side-by-side comparison of those parts of Swift and Kotlin that make them seem as if they’re dialects of the same parent language.

…or maybe it isn’t!

If you don’t read Japanese, you’ll need to run Swift is NOT like Kotlin through a translator (Chrome will automatically offer to do so), but it’s worth doing. The article highlights three features where the languages first appear similar, but upon closer inspection are rather different:

  1. Protocols and extensions
  2. enums
  3. Properties

Anything you can do, I can do better

Anything you can do, I can do better is a presentation at UIKonf 2017 by two engineers at Kickstarter — an Android engineer who got into iOS development, and an iOS engineer who got into Android development — where they talk about how they develop for Android and iOS using functional programming, Swift, and Kotlin. A good chunk of the presentation is devoted to a tour of Kotlin “all its similarities, strengths, and weaknesses with respect to Swift”.

If you want to dive really deeply into what they’re talking about, they point to the GitHub repos for Kickstarter’s open source iOS and Android apps:

SwiftKotlin: A Swift-to-Kotlin translation tool

SwiftKotlin is a framework/command line tool/Mac application that applies transformations to Swift code to convert it into Kotlin. According to its README on GitHub:

It applies transformations to the Swift code to get as correct as possible Kotlin code (see limitations below). It does string transformations as well as some more complicated ones like transforming guard statements to negative if statements, properties, memory management and many others.

Swift vs. Kotlin for real iOS/Android apps

Here’s a comparison of Swift and Kotlin that starts with a laundry list of differences, followed by a simple app that consumes OpenTable’s API implemented in both Swift and Kotlin.

“Swift and Kotlin” presentation

Here’s a presentation that does a side-by-side comparison of Swift and Kotlin.

Uncle Bob on Swift and Kotlin’s “Dark Path”

An actual still from one of Uncle Bob’s “Clean Coder” videos, in which his Starfleet self talks to his mirror universe self.

Robert C. “Uncle Bob” Martin is the “Clean Code” guy and one of the attendees of the Hot Tub Time Machine-like ski gathering in 2001 that gave rise to the Agile Manifesto. In a recent blog post titled The Dark Path, he wrote:

Over the last few months I’ve dabbled in two new languages. Swift and Kotlin. These two languages have a number of similarities. Indeed, the similarities are so stark that I wonder if this isn’t a new trend in our language churn. If so, it is a dark path.

Swift constructs for Kotlin

Here’s a quick article that shows you how to implement Kotlin versions of some Swift goodies that you may have become used to.

Kotlin, Swiftly

Episode 257 of the podcast Coder Radio spends a fair bit of time on Kotlin, including its similarity to Swift.

Will Swift and Kotlin change the face of mobile development?

You can read this entire article, or just the final paragraph:

While it’s unlikely that we’ll reach the point of just using one of these languages to code for both mobile platforms anytime soon, their similarity, and the fact that their adoption is moving outside of just the mobile arena, will impact our mobile teams. More robust products built from closer developer collaboration, consolidated and streamlined support teams, and the ability to keep developers engaged by allowing them to more easily work as full stack developers, are some of the ways future mobile teams will be different from those of today.

{ 1 comment… read it below or add one }

1 Sarah Bishop May 23, 2017 at 11:02 pm

Thanks for sharing this article with the comparison.

Leave a Comment

Previous post:

Next post: