Coder Social home page Coder Social logo

saifi369 / passingstateswithsealedclasses Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 103 KB

Passing UIState from viewmodel to activity using kotlin sealed classes

Home Page: https://www.youtube.com/u4universe

Kotlin 100.00%
uistate viewmodel kotlin video enums mvvm android sealed-class

passingstateswithsealedclasses's Introduction

Passing UIState from ViewModel to Activity with Kotlin Sealed Classes

This project is used for tutorials on U4Universe Youtube channel.

Introduction

As our android app uses MVVM architecture, often times we need to send Commands to our View(Activity) from ViewModel.

We can do this using kotlin enums but there is a limitation with enums. We cannot pass any custom data to View with enums.

Kotlin provide another solution for this ---> SealedClasses

We'll learn

  • Create UIState with Sealed Classes
  • Send States from ViewModel to Activity
  • Update the View according to Ui States

Contact Info

You can contact me if you have any problem related to code or video.

Instagram

Facebook

Gmail [email protected]

Note

This repository may contain multiple branches. Each video uses its own branch, so make sure to check the branch used in the video and then select that branch from branch list.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

passingstateswithsealedclasses's People

Contributors

saifi369 avatar

Watchers

 avatar

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.