Swift が Android 上で動き始めてよく分かる Kotlin の素晴らしさ

Swift がAndroid上で動き始めており,

_RFC__Port_to_Android_by_modocache_·_Pull_Request__1442_·_apple_swift

[RFC] Port to Android by modocache · Pull Request #1442 · apple/swift

Hacker News でも少し話題になっていたので眺めておりました.

Swift_Ported_to_Android___Hacker_News

Swift Ported to Android | Hacker News

「Swift が Android上で動くこと」について話題がされているかと思いきや Kotlin と比較され, Kotlin のAndroid上で動かすことの良さがはっきりと分かるスレになっておりました.

Surprised noone mentions Kotlin. It's quite Swift-like, backed by JetBrains (Android Studio is based on their IntelliJ Idea), and 1.0 has only just been released. It has full interoperability with Java.

Kotlin に誰も言及していないのが驚き. Kotlin は Swift によくにており, JetBrains (AndroidStidioのベースとなるIntelliJ Idea の開発元)がバックアップしており, 1.0 がリリースされたばかりのもので Java と完全に相互連携ができる.

I love Kotlin, but being able to develop libraries in one language and use them in both Android and iOS is huge. I have been using J2Objc for this until now, and while it's a great tool, it forces me to use Java, which I don't love. I would prefer being able to use Kotlin on iOS, but using Swift for Android development is a great boon.

私はKotlinが好きだが, ひとつの言語でAndroidとiOSで開発ライブラリを利用可能にすることは大変だ. いままで J2Ojc を使っておりこれは素晴らしいツールでJavaを使うことを強いられるが私は好きではない. それより Kotlin を iOS上で利用可能にするほうがいい. Android開発にSwiftを使うのは 非常にありがたいのだが...

Kotlin emits bytecode. It is entirely interoperable with Java. All the Java APIs of the platform are accessible in Kotlin.
Swift on the other end can only target the NDK, which limits it to a very specific niche on Android.

Kotlin はバイトコードを吐く, これは Java と完全に相互連携できること. すべてのJavaAPI はKotlin で利用できる.
一方 Swift は Android上では NDKのみに限定され非常に狭い.

What helps a lot is that the kotlin team has written many helper methods allowing a better flow between the android API and kotlin code : while you don't need it in order to get interop, it allows to more easily write idiomatic kotlin code while interacting with Android.

Kotlin チームの書いたたくさんのヘルパーメソッドは, Android API と Kotlin 間の流れをより良くしており, Swift ユーザがそれを利用しないことと対照的に, Androidと連携しながらより簡単に慣用的な Kotlin コードを書くことができる.

The main problem with Swift on Android is that AFAIK it is going to be limited to NDK.
There is certainly a niche where it can be useful, but for most developers, it makes it a no go.
Kotlin on the other end is indeed a very good stand-in replacement for java on Android.

私の知る限りSwift を Android上で動かすことの大きな問題は NDKに限定されることだ. このことは確実に便利さを狭めておりそれが進行を妨げている. 一方, Kotlin は確かに Android 上での Java の代替となる.

No one cares if you don't use Swift. Go with Kotlin. It's probably a great choice for you. It seems like a great language and I hope it gains traction.

Swift は使わなくて良い. Kotlin でいこう. あなたにとって素晴らしい選択となる. 偉大な言語で勢いを増すことを願っている.

If all you're doing is Android programming Kotlin is probably a better choice at this time. If you're a Java programmer, Kotlin is probably a better choice. If you're already a Swift programmer...
Also, let's see how both languages gain traction in the next 3-5 years.

Androidプログラミングのみを行っていたり, Javaプログラマーであるなら Kotlin はおそらくより良い選択です. もしあなたがすでにSwiftプログラマーであるなら...
次の3-5年でそれぞれがどのように勢いを増すかを見ておきましょう.

しかし,「ことりん」て名前. かわいいよなあ.

あの「Hacker News」で ベストなストーリーを見つける方法


関連ワード:  AndroidAndroidStudioおすすめアプリツール初心者評判開発