Which is the preferred MVVM framework for Xamarin cross platform development? Any suggestions from experience will be helpful.
thanks!
There are many MVVM Frameworks available for Xamarin. iOS and Xamarin. Android development: MVVMCross, MvvmLight, PrismMVVM, ReactiveUI.
MvvmCross is a cross-platform MVVM library that allows you to put a common PCL directly from xamarin. android and xamrin. ios.
The Model-View-ViewModel (MVVM) pattern helps to cleanly separate the business and presentation logic of an application from its user interface (UI).
MvvmCross has some setup code provided by the framework, and inside this setup code you initialize the content of the IoC container. MVVM Light, on the other hand, relies on you doing this inside your own app code.
There are many MVVM Frameworks available for Xamarin.iOS and Xamarin.Android development: MVVMCross, MvvmLight, PrismMVVM, ReactiveUI. I've had the most success using ReactiveUI for MVVM and Splat for IoC.
Xamarin.Forms is designed with MVVM in mind, and you don’t need a framework to develop a Xamarin.Forms application, with the MVVM pattern. As your application becomes, MVVM Frameworks do contain a lot of things to help you, and are certainly worth a look. In relation to MVVM, Xamarin.Forms includes the following two features.
The cop out answer is "it depends", but it really does. If you have used MVVMCross, MVVMLight for Xamarin Native applications before (or Prism for native Windows applications) and are now using Xamarin Forms, it makes sense to continue to use what you're used to.
MVVMCross and MVVMLight have very high average downloads per day, but their history goes way back before Xamarin Forms became popular. So that would leave Prism as the highest downloads from a pure Xamarin Forms point of view. MVVMLight and Caliburn.Micro only have one major contributor and suitable for light applications.
There are many MVVM Frameworks available for Xamarin.iOS and Xamarin.Android development: MVVMCross, MvvmLight, PrismMVVM, ReactiveUI.
I've had the most success using ReactiveUI for MVVM and Splat for IoC.
The best feature about ReactiveUI is that it doesn't require any ViewModel Navigation. You may think that ViewModel-based Navigation is a good thing, but it can make your life much more difficult when implementing complex navigation patterns. iOS and Android have view-based navigation built-in, and I recommend leveraging those instead of trying to re-create the wheel by using ViewModel-based navigation.
You mentioned in the comments that you're not using Xamarin.Forms, but I wanted to include this in case another developer has a similar question for Xamarin.Forms.
Don't use an MVVM Framework with Xamarin.Forms.
Xamarin.Forms has a binding engine included. I've seen many developers over-complicate their Xamarin.Forms projects by implementing heavy frameworks like MVVMCross into Xamarin.Forms without receiving much benefit.
Xamarin.Forms doesn't include an IoC container, and you may want to add one to your project: TinyIoC, Autofac, Ninject, Splat.
I have had the most success using Splat.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With