Skip to content

TinNova/TodoList

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
app
 
 
ios
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Todo List App

This app is an experiment in Kotlin Multiplatform. It is a simple one-page app which allows you to add a test to a recyclerview and to tap on the item to delete it.

After reading a few articles on Kotlin Multiplatform I settled on the interpretation of it from this article Link.

The reason I choose the above interpretation is because it mimics the MVVM pattern recommended by Google, inface the Moko MVVM library is even lifecycle aware. It also suggests using the Kodein Dependency Injection library which is extremely easy to use and setup.

Folder Structure

The project has two module:

  • KotlinMultiplatform this contains the app folder and share folder, it would also contain the ios folder
  • commonMain is the Kotlin Multiplatform library that's accessible to both apps

Code Walk-Through

  • The commonMain folder has a ViewModel, TodoRepo and a Todo data class
    • This means the code can be used by ios and android.
  • In the app folder we only have the MainActivity, Adapter and a callback Interface
    • These classes are specific to the android os
  • The ViewModel is only concerned with retrieving data from the TodoRepo and delivering it to the View.
  • The TodoRepo is the sole class that has access to the Todo list
  • The Todo model only contains a string, it doesn't need to exist, but in the future I can imagine a check box or a date stamp being associated with every Todo entry and by having the model already created it means there's minimal refactoring involved.
  • This setup made unit testing very easy.