Skip to content

Instantly share code, notes, and snippets.

View ArtemZu's full-sized avatar
🎯
Focusing

Artem Zubach ArtemZu

🎯
Focusing
View GitHub Profile
class ProductViewModel : ViewModel() {
val products = MutableLiveData<List<Product>>()
val loading = MutableLiveData<Boolean>()
val error = MutableLiveData<String>()
fun loadProducts() {
loading.value = true
viewModelScope.launch {
try {
val response = RetrofitClient.api.getProducts()
@Composable
fun UserListScreen(users: List<User>) {
var searchQuery by remember { mutableStateOf("") }
Column {
TextField(
value = searchQuery,
onValueChange = { searchQuery = it },
placeholder = { Text("Search users") }
)