Announcing FreshMvvm 2.1 and 2.2

Your favourite Mvvm Framework for Xamarin.Forms just keeps getting better. At XAM Consulting we use FreshMvvm in all of our serious production applications, the fact that we use FreshMvvm so intensely is the reason that FreshMvvm is easy to use, robust and flexible.

There’s been two releases of FreshMvvm since I last updated, Version 2.1 and Version 2.2.

Release 2.2.0

Better debug messages displayed

In previous versions of FreshMvvm construction errors of pages were in a few levels of inner exceptions, so if your xaml had a little error you had to dig into the inner exceptions. It was not an issue for experienced users of FreshMvvm but for people new to the Framework it was a bit hard to figure out the actual issue. Now exceptions will be bubbled up developers won’t need to look into inner exceptions.

Ability to remove a page from Navigation

In some cases you might want to remove a page from the Navigation stack. This works in the case you’ve Pushed a few pages but want to remove one of the pages from the stack before you return,  for example you’ve pushed to Page1 -> Page2 -> Page3, but you essentially you don’t want Page2 to be part of the stack anymore. In this case you can call the remove method.

CoreMethods.RemoveFromNavigation<Page2ViewModel>();

Add ability to SwitchSelectedRoot page in Tabs and MasterDetail

This is another special finite feature of FreshMvvm, in which you can switch the currently selected page of the main tabbed page or the master detail page.

//switch the selected tab to the HomePageModel
CoreMethods.SwitchSelectedTab<HomePageModel>();

//switch selected master to the HomePageModel
CoreMethods.SwitchSelectedMaster<HomePageModel>();

//switch selected to the HomePageModel
CoreMethods.SwitchSelectedRootPageModel<HomePageModel>();

 

Release 2.1.0

Adds ability to control PageModel mapping via PageModelMapper

You now have the ability to control the convention of mapping ViewModel to pages. You do this by using the IFreshPageModelMapper.

public interface IFreshPageModelMapper
{
    string GetPageTypeName(Type pageModelType);
}

Currently the PageModel mapper is defaulted to  the FreshPageModelMapper.

public static class FreshPageModelResolver
{
    public static IFreshPageModelMapper PageModelMapper { get; set; } = new FreshPageModelMapper();
    ...

The current behaviour is to map PageModel or ViewModel to Page.

public class FreshPageModelMapper : IFreshPageModelMapper
{
    public string GetPageTypeName(Type pageModelType)
    {
        return pageModelType.AssemblyQualifiedName
            .Replace ("PageModel", "Page")
            .Replace ("ViewModel", "Page");
    }
}

It’s easy to implement your own custom mapper and then set the PageModelMapper.

FreshPageModelResolver.PageModelMapper = MyPageModelMapper();

Adds ability to navigate without animation

You can now push and pop PageModel without animations.

Better cleanup of objects

We clean up after ourselves, even better now. 🙂

IOC now has unregister feature

You can now unregister a class out of the IOC container.

Add First Only Tabbed Navigation Container

FreshMvvm has always had a built in tabbed navigation container, the behaviour of this navigation is to keep the tabs always present but this is not what you always want. In some case you want the tabs to disappear when you push to a page, so we created the FreshFONavigationContainer. The FO stands for First Only and it means this tab page will only appear on the first page of the app.

FreshMvvm in Production

It makes us happy to see that so many others are also delivering great apps using FreshMvvm. I was recently informed that the Fraedom Expense app was built with FreshMvvm. Great work.

As always the latest version of FreshMvvm is up in nuget right now.

Thanks

 

6 Responses

  1. Hi, thanks for the great work.

    Is there a new repo for the latest code? I can’t seem to find the latest 2.2.0 changes on the main github repo. Or has this project moved in-house? (A pity if so!)

    Cheers

  2. Hi Michael,

    Thanks for this awesome framework!

    The new version’s SwitchSelectedTab fixed a problem that I had, so thanks again.
    I decided to use FreshTabbedFONavigationContainer, but now I have another issue: my tabbed page won’t show the title of each page on navigation’s title (just a static string I pass to FreshTabbedFONavigationContainer’s constructor). Is there a way I can fix that?

    1. Hi Lucas

      Great to see you using FreshMvvm, we’ve seen that before and it might work if we updated the Title on the TabbedPage when the current selected Tab changes. I will see if I can fix that for you.

  3. Hi Michael,

    Is it possible to use FreshMvvm with Visual Studio ?
    I saw your videos but you use always Xamarin Studio.

    Thanks

Leave a Reply to Lucas Carvalho Cancel reply