Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kotlin Multiplatform | Kotlin/Everywhere Venezia

Kotlin Multiplatform | Kotlin/Everywhere Venezia

In this talk, we will see how it's possible to create a mobile application for Android and iOs that share some code (for example business logic, network, etc.) using Kotlin Platform. We will show a real application that we have built for this talk, i.e. a showcase app for the GDG Venezia.

We will show also how it's possible to create a backend for this app by of course using Kotlin!

This talk has been done in collaboration with Andrea Maglie that I thank

Marco Gomiero

October 30, 2019
Tweet

More Decks by Marco Gomiero

Other Decks in Programming

Transcript

  1. Agenda • About Kotlin Multiplatform • Project Structure • Our

    App • Some Code Break • Backend • Conclusions
  2. The real trouble Unify UI declaration across platforms React Native:

    call native widgets through a “bridge” PRO: Use of native widgets CONS: The bridge causes delays
  3. The real trouble Unify UI declaration across platforms Flutter: uses

    its own widget PRO: No delays, really fast CONS: Use of custom widgets
  4. “Overall, multiplatform is not about compiling all code for all

    platforms” https://kotlinlang.org/docs/reference/multiplatform.html
  5. Kotlin Multiplatform: How it works Compiling code for all platforms

    has limitations: • Every platform has unique APIs • Impossible to cover all platforms API
  6. Kotlin Multiplatform: How it works Solution: • Share as much

    code as needed • Access platform APIs through the expected/actual mechanism
  7. Use case: Android - iOs Share part of the code

    like business logic, connectivity..
  8. The logic may be reused on both the server and

    the client side running in the browser Use case: Client - Server
  9. How to compile? Android ./gradlew installDebug iOS > ./gradlew common:iOSBinaries

    > cd ios > pod update > open GDGVeneziaShowcase.xcworkspace
  10. • The bottleneck of cross-platform framework is the unification of

    the UI definition • Sharing only some part of the code is the (future) solution Conclusions