This course is available as part of the Professional subscription. To learn more click here

Kotlin/Native and Multiplatform

Apr 2 2019 · Video Course (2 hrs, 38 mins) · Advanced

In this course, you will be introduced to Kotlin/Native and build a Kotlin Multiplatform app that runs on both iOS and Android using shared Kotlin code.


  • Kotlin 1.3, Android 5.0, Studio 3.3.1

Getting Started with Kotlin/Native


5:09 Free

Welcome to the Kotlin / Native for iOS video course! In this introduction, find out what the course will cover.


We'll give more precise definitions of Kotlin/Native and Kotlin Multiplatform, and look at how they allow you to share code across iOS and Android.


Install the Kotlin/Native compiler Konan on macOS, and contrast it with the kotlin-jvm compiler installed using Homebrew.


Write your first Kotlin program for the command-line on macOS, and add code that utilizes the Kotlin standard library.


Test your knowledge of how to compile code using Kotlin/Native through a hands-on challenge, writing a Kotlin/Native program on your own.


Compare writing a program using Kotlin/Native with writing a Kotlin script that is run using the kotlin-JVM compiler, through a hands-on challenge.


Get an introduction to the Integrated Development Environments that we will use in the course, including Android Studio, Xcode, and AppCode.




Review all that you've done in Part 1 of the course, and take a look ahead at where we'll be going in Part 2 on Kotlin Multiplatform.


Multiplatform and Shared Code

See what we'll be covering in Part 2, and learn about the advantages that Kotlin Multiplatform provides over the typical app development process.


Use Android Studio to create the root project and Android project for the Multiplatform app, and set up the shared project at the command-line by hand.


Write the Gradle build script that determines how to compile the shared code into a jar file for use on Android and a framework file for use on iOS.


Use the Kotlin expect keyword to define an interface that can be used in the shared code and the actual keyword to provide platform-dependent implementations.


Include the shared project in the Android app as a dependency, and access the shared module from the Android code.


Use Xcode to create the iOS project for the Kotlin Multiplatform app, and update the build script of the shared project for integration with Xcode.


Add a label to the main iOS storyboard, and update the iOS project to use the shared framework to display a greeting in the label.


Test your understanding of the set up of the shared code by modifying the output produced on iOS, and build the shared project from Xcode.




Review all that you've done in Parts 1 and 2 of the course, and take a look ahead at where we'll be going in Part 3.


Networking, Concurrency, and Serialization

See what we'll be covering in Part 3 of the course, adding networking, concurrency, and serialization into the Multiplatform app.


Use the ktor-client and Kotlin coroutines to add an API class to the project for making a network call to the GitHub API.


Get introduced to CoroutineContext, Dispatchers, CoroutineScope, and coroutine builders, and use them to create a base presenter class in the shared module.


Define a Model-View-Presenter structure within the Multiplatform app, including a data repository which presenters will query for data to send to the view.


Implement the MVP view interface in the Android app code, and show the data from the shared network call in the Android app.


Implement the MVP view interface in the iOS app code, and show the data from the shared network call in the Xcode console.


Use the kotlinx.serialization library to add JSON deserialization into the shared project, and turn the network JSON response into a list of Kotlin instances.


Update the Android app to add a RecyclerView to display the list of data that is provided by the shared presenter.


The iOS UI


Update the iOS app to add a UITableView to display the list of data that is provided by the shared presenter.




Review all that we've done in Parts 2 and 3 of the course to create shared code that can be used on iOS and Android, and take at where we'll be going in Part 4.


AppCode, Debugging, and Gotchas

See what we'll be covering in Part 4 of the course on AppCode, Multiplatform debugging, and Gotchas you may run into in a Kotlin Multiplatform project.


Use AppCode to create a macOS command-line project, and redo the small program we wrote in Part 1 of the course.


See how AppCode can be used to write an iOS app using Kotlin instead of Swift, and learn about pros and cons of this approach.




See a brief demonstration of what debugging looks like when developing a Kotlin Multiplatform app using IDEs like Android Studio and Xcode.




Review the various risks that you take when embarking on a Kotlin Multiplatform project, and see other potential gotchas that you may run into.




See a summary of the important benefits that Kotlin/Native and Multiplatform offer you, and then review the course and take a look at where to go from here.


Who is this for?

This course is for mobile developers interested in learning how to introduce code-sharing between their iOS and Android app projects by leveraging the Kotlin/Native compiler and adopting the Kotlin Multiplatform approach.

You should be familiar with either iOS or Android development, and have at least some basic knowledge of developing for both of the platforms. You should also have experience with using the Kotlin language and be comfortable using the command line.

iOS developers new to Android and Kotlin will want to learn the basics of Android and Kotlin development prior to beginning the course.

Covered concepts

  • Kotlin/Native
  • Kotlin Multiplatform
  • Sharing code between iOS/Android
  • expect and actual keywords
  • Ktor client and Coroutines
  • Serialization
  • AppCode for Multiplatform