Skip to content
loading...

Kotlin or Swift

Randy Arba on November 22, 2019

When everyone talking about native development or hybrid development, i just wanna talk about the programming language. Yes, for native development... [Read Full]
markdown guide
 

If you have a target platform in mind, go Kotlin, if that platform is Android or JVM, and Swift if your target is going to be iOS or MacOS. If your target is multiplatform, I recommend Kotlin, as Kotlin has built-in multiplatform support.

 

Yes you right, kotlin multiplatform can do that, in business logic side, in view side or UI side i think not, because IOS still use swift to write the UI.

 

You'll definitely still be writing the UI in Swift! But you can write the UI in Swift, as well as the functions that Kotlin doesn't do! Moving in the other direction, programming for JVM, Android, etc, it quite the endeavor, though, and doesn't seem to be supported.

 

Swift has no data classes, does not have delegation or delegated properties, also doesn't allow annotations.

Kotlin's classes are final by default, has no struct or passing by value, doesn't have tuples, no type alias, and no guard statement/s.

Swift relies on ARC garbage collection and no it's not similar to C++ or Rust, Swift runs on top of Objective C code using llvm bit-code, so it does compile to native but has few extra steps, making it slower than C++, I don't think you can compare Swift with C++, it's definitely faster than Kotlin but that doesn't make it comparable with C++.

C++ directly compiles to machine code, but if not optimized, it can act like Java/Kotlin.

 

Very nice it's so detail, thanks for adding more pros and cons. I just write the general thing, but you awesome to add more. Yes actually other language can improve and extends to LLVM if that language can support JIT or AOT, and especially kotlin, kotlin can be native development with their LLVM, but it like you said before it same as swift kotlin native, it does compile to native with has few extra steps and making slower, but i am not sure compare the both language kotlin and swift about the performance if they do in LLVM mode. Thanks you for your comment. nice discussion.

code of conduct - report abuse