Daniel Hindrikes
Developer and architect with focus on mobile- and cloud solutions!
Developer and architect with focus on mobile- and cloud solutions!
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 ran Initialize
during OnAppearing
. 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 pass true
to the constructor of ViewBase
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. The ViewBase
is refactored so IViewModelBase
is used instead of ViewModelBase
. This is a request from a developer that uses TinyMvvm and it makes the library more flexible.
If you want to read more about TinyMvvm, I recommend the Get Started Tutorial, and also these blog posts:
The full source code and documentation can be found on GitHub. Feedback and contributions are very welcome.