Today, I released a new version of TinyMvvm, 2.4.1.
The release contains this:
-
Added
ShellViewBase
to optimize how ViewModels are created. Before the ViewModel was created during OnAppearing when using Shell navigation. It also ranInitialize
duringOnAppearing
. But there are cases where you want it to run earlier, so I added a new class that you can use to achieve that. You can also passtrue
to the constructor ofViewBase
to achieve the same thing.In XAML and ShellViewBase:
<mvvm:ShellViewBase xmlns:mvvm="clr-namespace:TinyMvvm.Forms;assembly=TinyMvvm.Forms" xmlns:vm="clr-namespace:SampleApp.ViewModels" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SampleApp.Views.MainView" x:TypeArguments="vm:MainViewModel"> </mvvm:ViewBase>
With a parameter to the constructor of ViewBase:
public partial class MainView { public MainView() : base(true) }
<mvvm:ViewBase xmlns:mvvm="clr-namespace:TinyMvvm.Forms;assembly=TinyMvvm.Forms" xmlns:vm="clr-namespace:SampleApp.ViewModels" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SampleApp.Views.MainView" x:TypeArguments="vm:MainViewModel"> </mvvm:ViewBase>
-
Removed the need of
TinyMvvm.Initialize();
It now marked as obsolete, so it will not break your code. The big win by removing the need for it is that it is easier to get started with TinyMvvm. -
Refactored so that
ViewModelBase
implements the new IViewModelBase interface. TheViewBase
is refactored soIViewModelBase
is used instead ofViewModelBase
. This is a request from a developer that uses TinyMvvm and it makes the library more flexible.
Read more
If you want to read more about TinyMvvm, I recommend the Get Started Tutorial, and also these blog posts:
- Autofac vs TinyIoC
- TinyIoC for TinyMvvm
- Snippets for TinyMvvm
- TinyMvvm 2.2 – Shell Navigation Updates
- TinyMvvm 2.1.1 – Introducing ViewModel navigation
- Introducing TinyMvvm 2.0
- TinyMvvm – The best MVVM library for Xamarin.Forms!?
Contribute
The full source code and documentation can be found on GitHub. Feedback and contributions are very welcome.
One thought on “TinyMvvm 2.4.1”