Reactive Extensions (Rx) + MVVM =?

I’ve written a framework that represents my explorations in this question called ReactiveUI It implements both an Observable ICommand, as well as ViewModel objects who signal changes via an IObservable, as well as the ability to “assign” an IObservable to a property, who will then fire INotifyPropertyChange whenever its IObservable changes. It also encapsulates a … Read more

How to inject a ViewModel into a composable function using Hilt (Jetpack Compose)

From version androidx.hilt:hilt-navigation-compose:1.0.0-alpha02 you can inject view model into Composable functions by: hiltViewModel<ViewModelType>() Example: @Composable fun LoginScreen(viewModel: LoginViewModel) {} LoginScreen( viewModel = hiltViewModel<LoginViewModel>() ) Android Developer Documentation compose and hilt UPDATE: import androidx.hilt.navigation.compose.hiltViewModel @Composable fun LoginScreen( viewModel: LoginViewModel = hiltViewModel() ){ val videos=vm.watchLater.observeAsState() val context= LocalContext.current }

MVVM vs Bloc patterns

Looking at this illustration for MVVM (source): You can see that there are seperate data and business logic models. However, using BLoC there is not really a distinction like that. The classes that handle the business logic also handle the data, which can also apply to MVVM. To be fair, there really is not much … Read more

MVVM Light: Adding EventToCommand in XAML without Blend, easier way or snippet?

Suppose you use .NetFramework4: First add namespace: xmlns:cmd=”clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform” Syntax for the Loaded event. <i:Interaction.Triggers> <i:EventTrigger EventName=”Loaded”> <cmd:EventToCommand Command=”{Binding Mode=OneWay, Path=LoadedCommand}” PassEventArgsToCommand=”True” /> </i:EventTrigger> </i:Interaction.Triggers>

What are the pros and cons of View-first vs. ViewModel-first in the MVVM pattern [closed]

Given the Data Templating feature in WPF, I feel ViewModel-First is the way WPF was intended to be used. I’ll clarify that statement: Data Templating allows you to never instantiate views from your ViewModel. If done correctly, your Views and ViewModels could be kept in seperate projects that DO NOT reference each other. Furthermore, the … Read more

Kotlin Extension Functions Databinding

You have to import CityKt firstly into xml <import type=”my.package.domain.country.model.CityKt” /> int the data section then you can use it like this <TextView android:id=”@+id/city” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”@{CityKt.streetName(city)}” /> If you review CityKt you will see that there is static Java method with City as first argument

MVVM Routed and Relay Command

RoutedCommand is part of WPF, while RelayCommand was created by a WPF Disciple, Josh Smith ;). Seriously, though, RS Conley described some of the differences. The key difference is that RoutedCommand is an ICommand implementation that uses a RoutedEvent to route through the tree until a CommandBinding for the command is found, while RelayCommand does … Read more

tech