Starting from 0.12 version, FlexiMvvm packages will be maintained and updated separately. You can install packages in your project independently.
You can track list of changes for each package using the links below:
- FlexiMvvm.Bindings
- FlexiMvvm.Collections
- FlexiMvvm.Essentials
- FlexiMvvm.Lifecycle
- FlexiMvvm.FullStack
- Navigation crashes from time to time.
FlexiMvvm.Bindings module:
- Added bindings for RatingBar.
FlexiMvvm.Common module:
FlexiMvvm.Ioc.ISimpleIoc
implements theSystem.IServiceProvider
interface in addition to theFlexiMvvm.Ioc.IDependencyProvider
one.FlexiMvvm.Ioc.IDependencyProvider
will be removed in 0.10.8 release.FlexiMvvm.Interactions.Interaction*
classes are moved to the FlexiMvvm.Lifecycle module,FlexiMvvm.ViewModels
namespace.
FlexiMvvm.Lifecycle module:
- FlexiMvvm.Lifecycle is now a release candidate! Significant breaking changes are no longer expected.
FlexiMvvm.ViewModels.ViewModel
class has been renamed to theFlexiMvvm.ViewModels.LifecycleViewModel
andFlexiMvvm.ViewModels.ItemViewModel
has been renamed to theFlexiMvvm.ViewModels.ViewModel
. Based on observation, almost every developer usesFlexiMvvm.ViewModels.ViewModel
as a base class for their own view models. But this is not entirely correct. Therefore, renaming was done. There are the following rules to determine which class should be used as a base one:- Use
FlexiMvvm.ViewModels.LifecycleViewModel
as a base class if its owner is Activity/Fragment for Android platform or UIViewController for iOS one. Only view models inherited fromFlexiMvvm.ViewModels.LifecycleViewModel
can participate in the navigation, save its state and be initialized by its owner. - Use
FlexiMvvm.ViewModels.ViewModel
as a base class if it is owned by another view model or a view not mentioned above. Such view models cannot participate in the navigation or persist own state.
- Use
FlexiMvvm.ViewModels.LifecycleViewModel.Initialize*
methods takes one more parameter:recreated
. It hastrue
value in case when the view model has been destroyed to recover memory and recreated with a restored state if it was persisted. If you are doing navigation in your view model then you need to write:
public override void Initialize(bool recreated) { base.Initialize(recreated); // Call NavigateToItem() only if Initialize() is called first time if (!recreated) { NavigateToItem(DefaultItem); } }
Android will restore UI itself, so you don't need to perform navigation when recreated is true
. The code above is equivalent to the one for Android:
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (savedInstanceState == null) { NavigateToItem(DefaultItem); } }
recreated
always has false
value for iOS due to a view model is never recreated on this platform.
FlexiMvvm.ViewModels.ViewModelProvider
isFlexiMvvm.ViewModels.LifecycleViewModelProvider
now,FlexiMvvm.ViewModels.DependencyProviderViewModelFactory
isFlexiMvvm.ViewModels.DefaultLifecycleViewModelFactory
(which expects aSystem.IServiceProvider
instance as a constructor parameter instead ofFlexiMvvm.Ioc.IDependecyProvider
one).FlexiMvvm.ViewModels.ViewModelFactory
class has been deleted, so implement theFlexiMvvm.ViewModels.ILifecycleViewModelFactory
interface instead.FlexiMvvm.ViewModels.ObservableObject
class has been moved to the FlexiMvvm.Common module and is available in theFlexiMvvm
namespace.
FlexiMvvm.Navigation.NavigationService
no longer has methods for getting existing instances of views. All these methods have been moved to theFlexiMvvm.Navigation.NavigationViewProvider
class. In addition, it requiresILifecycleViewModel
instances instead ofIViewModel
ones.- Previously, FlexiMvvm-adapted
UIViewController
s had a parameterless constructor or constructor with parameters. The disadvantage of this approach that it is not possible to use constructors provided by iOS. Starting from 0.10.7, adapted view controllers have the same set of constructors as adaptable ones. This led to a change in the way parameters are passed for a view controller. Previously, to pass parameters in aUIViewController
instance, it was necessary to write like this:
var myParameters = new MyParameters(/* parameters initialization */); var myViewController = new MyViewController(myParameters); Navigate<MyViewController>(myViewController);
Now it is:
var myParameters = new MyParameters(/* parameters initialization */); var myViewController = new MyViewController(); myViewController.SetParameters(myParameters); Navigate<MyViewController>(myViewController);
or even a better approach (which is more consistent with the Android one):
var myParameters = new MyParameters(/* parameters initialization */); var myViewController = new MyViewController(); Navigate<MyViewController, MyParamters>(myViewController, myParameters);
- CanExecuteChanged event for a command not raised during the initial execution of bindings.
Feel free to get familiar with this release based on Xamarin Starter Kit.
- Added SpinnerObservableAdapter.
- Added bindings for AdapterView, Spinner, UIPickerView, IItemsSource.
- PickerViewObservableModel refactoring. Now it is more simple and works with positions instead of objects. New implementation is not compatible with old one.
- ValueSet crashes when call GetValue method.
- Switch on C# 8 for FlexiMvvm source code (main reason - nullable reference types support).
- Starting removing Jetbrains Code Annotations and replace them with nullable reference types.
- Replace
FlexiMvvm.Configuration.Config
class withFlexiMvvm.Collections.ValueSet
(API not changed, just renaming).
- If navigate from ActivityA to ActivityB for result and ActivityA killed by the Android then app crashes if return back.
- Cascading return result doesn't work properly in iOS.
- Bootstrappers*, Configuration*, Parameter, Result classes have been documented.
- Remove
OperationFactory property
from theViewModel
class.
- View models parameters are not passed to a
UITabBarController
.
- FlexiMvvm-adapted activity doesn't throw an exception anymore in Activity.OnActivityResult callback if its model doesn't implement IViewModelWithResultHandler. Reason: activities might communicate with each other without transmission the result to the view model.
- Added classes for view model to view interactions.
- ViewModel.InitializeAsync is called when UIViewController.ViewDidLoad/Activity.OnCreate methods completed. Previously it was called at the beginning of ViewDidLoad/OnCreate. It didn't allow access to views because there were not created yet.
- Now Config implements IConfig implicitly. Don't need to cast to IConfig to access GetView/SetView methods.
- NavigationService.Navigate methods crash for iOS.
- All navigation classes have been documented.
- *.snupkg symbols are uploaded to NuGet.org starting from 0.10.2 release. Read here how to consume*.snupkg from NuGet.org.