Upgrade from 4 to 5
EditNuGet package changes
Since MvvmCross 5.0 some packages have been changed or moved.
old NuGet package | new NuGet package |
---|---|
MvvmCross.Droid.Support.V4 |
MvvmCross.Droid.Support.Core.UI, MvvmCross.Droid.Support.Core.Utils, MvvmCross.Droid.Support.Fragment |
MvvmCross.Droid.Support.V7.Fragging |
MvvmCross.Droid.Support.Fragment |
MvvmCross.Forms.Presenter |
MvvmCross.Forms |
Core
To make sure your navigation stays up-to-date change all your ShowViewModel<>()
calls to the new navigation explained in the documentation
Example before:
private IMvxCommand _navigateCommand;
public IMvxCommand NavigateCommand
{
get
{
_navigateCommand = _navigateCommand ?? new MvxCommand(() => ShowViewModel<TViewModel>());
return _navigateCommand;
}
}
After:
private IMvxAsyncCommand _navigateCommand;
public IMvxAsyncCommand NavigateCommand
{
get
{
_navigateCommand = _navigateCommand ?? new MvxAsyncCommand(() => _navigationService.Navigate<TViewModel>());
return _navigateCommand;
}
}
Also your public void Init()
won’t be called anymore. This is because this was done using reflection. With the new navigation a method called public override async Task Initialize()
will be called. This method is typed and async.
iOS
iOS View Presenter and Tab bar control
With version 5 of MvvmCross the iOS View Presenter received a major overhaul. This results in a few changes especially when using the tab bar control.
- The
IMvxTabBarPresenter
(and its implementationMvxTabsViewPresenter
) have been removed and are now fully integrated with theMvxIosViewPresenter
class. When you are using the tab bar control, please replace theMvxTabsViewPresenter
with theMvxIosViewPresenter
; - Like in the previous versions you would still decorate your view controllers with the
MvxTabPresentationAttribute
attribute, however it has now moved to a new namespace. Namely fromMvvmCross.iOS.Support.Presenters
toMvvmCross.iOS.Views.Presenters.Attributes
. - The
MvxTabPresentationAttribute
no longer accepts theMvxTabPresentationMode
enum as a parameter. These options have now been replaced by their own attributes. See following table (all attributes are located in theMvvmCross.iOS.Views.Presenters.Attributes
namespace):
MxvTabPresentationMode | new Attribute |
---|---|
Root | MvxRootPresentationAttribute |
Tab | MvxTabPresentationAttribute |
Child | MvxChildPresentationAttribute |
Modal | MvxModalPresentationAttribute |
Detailed information regarding the new iOS View Presenter and the above attributes can be found in the iOS View Presenter section of the documentation.
Xamarin.Forms
Update your code to use the new base classes, support for MvvmCross bindings and improved presenters. Information about this can be found in: Xamarin.Forms
MvxFormsApp
has changed toMvxFormsApplication
Changes to test
The following things are recommended to test
- iOS Presenters and navigation
- Plugins you used that are removed now