GithubHelp home page GithubHelp logo

jarroyoesp / kotlinmultiplatform_mvvm Goto Github PK

View Code? Open in Web Editor NEW
229.0 12.0 28.0 2.82 MB

Android & iOS App using MVVM pattern and LiveData on the presentation layer + Clean Arch on the common shared code.

Kotlin 80.45% Swift 19.55%
kotlin kotlin-multiplatform mvvm-architecture coroutines mvvm-pattern android serialization clean-architecture

kotlinmultiplatform_mvvm's Introduction

Kotlin-Multiplatform MVVM (Android & iOS)

kotlin-version

Example of application using Kotlin Multiplatform and MVVM pattern for both platforms (Android & iOS). To achieve it the libraries used are:

  • moko-mvvm: This is a Kotlin Multiplatform library that provides architecture components of Model-View-ViewModel for UI applications. Components are lifecycle-aware on Android.
  • KTOR: to make HTTP requests
  • Serialization: to De/Serializing JSON
  • Kodein-DI: Dependency injector
  • kotlinx.coroutines: Library support for Kotlin coroutines with multiplatform support
  • SQLDelight: SQLDelight generates typesafe kotlin APIs from your SQL statements.

More detail in this post on ProAndroidDev: here

Unit Testing SharedCode

  • Added unitTest for GitHubRepository

kotlinmultiplatform_mvvm's People

Contributors

jarroyoesp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kotlinmultiplatform_mvvm's Issues

Question : About Kodein

Is Kodein the only DI tool that can be used or its just preference.

I Use Koin before multiplaform and want to know if i can use it

Question: LiveData + lifecycle

Hey, Javier. I only see you are using dev.icerock.moko.mvvm.livedata.LiveData.addObserver(), but you never do dev.icerock.moko.mvvm.livedata.LiveData.removeObserver(). Is it intentional?
If I add removeObserver() in onPause() and do addObserver() in onResume() - do you see any potential memory leaks here? compared to android's viewmodel.livaData.observe(viewLifecycleOwner, {})

About native-mt coroutines

Does the viewmodelscope in moko mvvm not need
withcontext(Dispatchers.Default){

////code here runs on background thread on both ios/android since viewmodel is in common module
}
and moko livedata postvalue emits to UI thread on both ios/android plaform

Is my understanding correct, if not without changing context the operations run on background thread and gets emitted in moko livedata. Please explain how background threads happen for network/db operations in the written codebase for viewmodel.

Error importing this project with Intellij 2019.2 Community

The error looks like that, and project cant be imported
10:33 Duplicate content roots detected
Path [C:/Users/Default/Documents/KotlinMultiplatform_MVVM-master/SharedCode/src/androidTest/kotlin] of module [SharedCode_androidAndroidTest] was removed from modules [SharedCode_androidTest]
Also 1 more path was deduplicated. See idea log for details

10:34 Duplicate content roots detected
Path [C:/Users/Default/Documents/KotlinMultiplatform_MVVM-master/SharedCode/src/androidTest/kotlin] of module [SharedCode_androidAndroidTest] was removed from modules [SharedCode_androidTest]
Also 1 more path was deduplicated. See idea log for details

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.