Last active
July 26, 2019 06:17
-
-
Save akshaybhange/08c954fd299ab2be5f42cf81d4dee0c0 to your computer and use it in GitHub Desktop.
how to move your logic from view to viewmodel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this is wrong | |
//writing logic for filtering items in your Fragmet | |
var filterList = simpleList.filter { it%2 == 0 } | |
//this is correct | |
//function created for it in your ViewModel | |
fun getEvenNumbers(simpleList : List<Int>):List<Int> { | |
return simpleList.filter { it%2 == 0 } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment