Swift Developers

Kotlin for Swift Developers: A Brief Comparison

Just as Swift is the future of iOS development, so too is Kotlin the future of Android development. The two languages have an uncanny similarity, as well. However, while we are still waiting for Swift to become available for server-side development, Kotlin can already be used anywhere Java is currently used. Hence, by picking up Kotlin, not only do you open the door to Android development without having to deal directly with Java, but full stack development suddenly becomes a reality. In this post I just want to give a high level comparison of the two languages. However in the posts to come I plan to share my findings as I deep dive into Kotlin and Android development while teaching it to college students.

Kotlin is a compiled language.
Just like in Swift, in Kotlin semicolons at the end of statements are completely optional

Kotlin, like Swift, supports type inference

Kotlin, like Swift, is a statically typed language

Kotlin, like Swift, supports optionals

Kotlin, like Swift, is both a functional and Object Oriented language

Kotlin can be used anywhere Java is used, i.e. on the server, in native mobile apps, and substituted for JavaScript (in development )

Functions work similarly to swift. Can be treated as values – passed as parameters, stored in variables, etc.

Generics support

Kotlin supports blocks, termed Lambda expressions

Kotlin doesn’t allow programmers to define their own operators, but it does support operator overloading.

Interoperable with Java, just as Swift is with Objective-C

There is a REPL (interactive shell) for Kotlin similar to Playgrounds for Swift. To use the Kotlin REPL from command line use the kotlinc command with no arguments.
Additionally there is an online playground for Kotlin, here: http://try.kotl.in

Kotlin, like Swift, has a mechanism for class extensions (unlike Java)

Because Kotlin runs on the JVM, like all other JVM based languages it uses garbage collection – unlike Swift and Objective-C.

About the Author Fuad Kamal

I provide mobile strategy & development for the Health & Fitness markets. Author of The Kotlin Book. Professor of Mobile Design & Development at Howard Community College, Columbia, Maryland. Photographer, Scientist, Cyclist, Martial Artist.

follow me on:

Leave a Comment: