Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Kotlin Multiplatform
How it usually happens
Android Project iOS Project
Server
What is wanted
Android Native UI iOS Native UI
Common code.
Business logics, model objects, backend interaction
Server
ISS Art. How to do IT. Kotlin Multiplatform
How it works :
commonMain
androidMain
(SharedPreferences)
iosMain
(NSUserDefaults)
iOS Target
.framework
Camera, Bluetooth, Map
android Target
.apk
Camera, Bluetooth, Map
I called for help...
...but nobody heard me
Lack of experience and level of skills
Studying the language, its
constructions and capacities
Compilation of all modules, linking
them together, adding
dependencies
There are no common libraries
Alamofire / RxSwift Retrofit / RxJava
ktor
kotlinx.serialization
coroutines
Version matters
All libraries used for ios must be compiled
by one version of kotlin/native
Kotlin/Native had unstable ABI because it was in beta
Nothing general - only specific
Try to use less generics in public interface
Generics were erased and to ios got only classes without types.
From version kotlin 1.3.40 generics basic support was added.
Multithreading
Think carefully about multithreading considering hard
limitations on working with objects from different threads in
Kotlin/Native
Kotlin/Native has mechanism of freezing objects and detach/attach
objects for transfer between threadings, which does not exist in jvm
Measure thrice and assemble once
Use compilation to android platform and compile in ios for
active development of general code when there are no
mistakes of compilation in general code
Kotlin/Native has no incremental compilation and compilation takes a lot of time
Jupiter can do what iOS can’t
Check current limits for Kotlin/Native working with
Serialization
Not all things are available in native (some time ago enum class and
inheritance were not available for native targets)
Debugging
Use breakpoint references in console by name to debug in
iOS or use plugin for xcode from touchlab
xcode does not allow to put breakpoint in kotlin file from box, but we can use
debugger lldb because compilation is done by llvm
You are lonely, but not alone
Android Project
Project for Android where we use KMP and OpenCV. Application serves to
identify amphibians and store information about them into base. It help
zoologists.
JumpStart Phone Charging
Application for interaction with the station of power banks. Available only in
Australia.
App Store
Play Market
Overcoming Pain via EMDR
Application for listening to meditations that help people to cope with mental
disorders. Application is actively used, constantly changing and developing.
Application has a fee for service.
App Store
Play Market
To sum up
It helps to save time of development. Using this technology for the project we
spent:
● For developing interaction from API server - 38 hours
● For realization of business logics and model classes - 24 hours
It was done in common module. If we developed in classical scheme we should
have done the same procedure for both platforms. Precisely these features helped
to save 62 hours.
ISS Art. How to do IT. Kotlin Multiplatform
ISS Art. How to do IT. Kotlin Multiplatform
Common code. Business logics,
model objects, backend interaction.
Android Native UI SwiftUI
Common code. Business logics,
model objects, backend interaction.
Android Native UI SwiftUI
Server
Common code. Business logics,
model objects, backend interaction.
UI
Kotlin Forums
Kotlin on Reddit
Kotlin in Documentation
Kotlin in Slack
Links
ktor
kotlinx.serialization
coroutines

More Related Content

ISS Art. How to do IT. Kotlin Multiplatform

  • 2. How it usually happens Android Project iOS Project Server
  • 3. What is wanted Android Native UI iOS Native UI Common code. Business logics, model objects, backend interaction Server
  • 5. How it works : commonMain androidMain (SharedPreferences) iosMain (NSUserDefaults) iOS Target .framework Camera, Bluetooth, Map android Target .apk Camera, Bluetooth, Map
  • 6. I called for help...
  • 8. Lack of experience and level of skills Studying the language, its constructions and capacities Compilation of all modules, linking them together, adding dependencies
  • 9. There are no common libraries Alamofire / RxSwift Retrofit / RxJava ktor kotlinx.serialization coroutines
  • 10. Version matters All libraries used for ios must be compiled by one version of kotlin/native Kotlin/Native had unstable ABI because it was in beta
  • 11. Nothing general - only specific Try to use less generics in public interface Generics were erased and to ios got only classes without types. From version kotlin 1.3.40 generics basic support was added.
  • 12. Multithreading Think carefully about multithreading considering hard limitations on working with objects from different threads in Kotlin/Native Kotlin/Native has mechanism of freezing objects and detach/attach objects for transfer between threadings, which does not exist in jvm
  • 13. Measure thrice and assemble once Use compilation to android platform and compile in ios for active development of general code when there are no mistakes of compilation in general code Kotlin/Native has no incremental compilation and compilation takes a lot of time
  • 14. Jupiter can do what iOS can’t Check current limits for Kotlin/Native working with Serialization Not all things are available in native (some time ago enum class and inheritance were not available for native targets)
  • 15. Debugging Use breakpoint references in console by name to debug in iOS or use plugin for xcode from touchlab xcode does not allow to put breakpoint in kotlin file from box, but we can use debugger lldb because compilation is done by llvm
  • 16. You are lonely, but not alone
  • 17. Android Project Project for Android where we use KMP and OpenCV. Application serves to identify amphibians and store information about them into base. It help zoologists.
  • 18. JumpStart Phone Charging Application for interaction with the station of power banks. Available only in Australia. App Store Play Market
  • 19. Overcoming Pain via EMDR Application for listening to meditations that help people to cope with mental disorders. Application is actively used, constantly changing and developing. Application has a fee for service. App Store Play Market
  • 20. To sum up It helps to save time of development. Using this technology for the project we spent: ● For developing interaction from API server - 38 hours ● For realization of business logics and model classes - 24 hours It was done in common module. If we developed in classical scheme we should have done the same procedure for both platforms. Precisely these features helped to save 62 hours.
  • 23. Common code. Business logics, model objects, backend interaction. Android Native UI SwiftUI
  • 24. Common code. Business logics, model objects, backend interaction. Android Native UI SwiftUI Server
  • 25. Common code. Business logics, model objects, backend interaction. UI
  • 26. Kotlin Forums Kotlin on Reddit Kotlin in Documentation Kotlin in Slack Links ktor kotlinx.serialization coroutines