Cocktail Directory App made with Kotlin
Kocktail Cocktail Directory App made with Kotlin Multiplatform Mobile Preview Libraries Used Code Overview Shared ViewModel class CocktailListViewModel : KMMViewModel() { private val api = CocktailAPI() private val _cocktailState = MutableStateFlow<CocktailListState>(CocktailListState.Empty) @NativeCoroutinesState val cocktailState: StateFlow<CocktailListState> = _cocktailState.stateIn( viewModelScope, SharingStarted.WhileSubscribed(), CocktailListState.Empty ) fun updateCocktailList() { _cocktailState.value = CocktailListState.Loading viewModelScope.coroutineScope.launch { try { val response = api.getCocktails() _cocktailState.value … Read more