TinyMvvm 2.4.1

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 trueto 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.

Read more

If you want to read more about TinyMvvm, I recommend the Get Started Tutorial, and also these blog posts:

Contribute

The full source code and documentation can be found on GitHub. Feedback and contributions are very welcome.

  7/13/2020 - 11:43 AM