Kotlin (and MVVM) Everywhere!
We Love Kotlin and JVM!
Our January post about the importance of proper MVVM for Kotlin explained why the Kotlin language is important.
Now it is time to stress the cross-platform nature of the
sample project.
With kt-mvvm-demo
you write your application once and deploy it to desktop, Android, iOS and browser
with the help of portable DukeScript presenters.
Android
The sample project comes
with classical Android Gradle installDebug
task to package your application
as an Android .apk
file and deploy it to your device or simulator:
iOS
One can package the same code
as an iOS .ipa
file with the help of Intel’s
Multi OS Engine when running on Mac OS X.
First of all list your simulators and then use one of them to launch your
application:
Browser
The same application
can also be transpiled to JavaScript and executed in
the browser. The bck2brwsrShow
tasks generates necessary .js
files and
launches a browser with the application
The files in web/build/web
directory
contain everything needed to execute your application and as such they can be
deployed to any HTTP server as a static content.
Read more.
With Kotlin MVVM API
you can write your code once, deploy and display it everywhere
(desktop - gradlew run
, Android - gradlew installDebug
,
iOS - gradlew moeLaunch
, browser - gradlew bck2brwsrShow
) while
using the power of Kotlin, its libraries and any other JVM libraries
on every target platform.
The JVM Portability
The fact that one can execute the same Kotlin application on all the above platforms is not like the traditional Kotlin.js and Kotlin.native portability. With Kotlin.xxx one only gets the portability of the Kotlin language, but not the libraries.
With the kt-mvvm-demo
project you may bring with yourself JVM libraries - e.g.
JARs - from your previous life (e.g. written in Java & other JVM languages)
that otherwise can’t go with you to the Kotlin js and native worlds.
We love Kotlin on the JVM!