What are some features of Fresh MVVM?

Technology CommunityCategory: XamarinWhat are some features of Fresh MVVM?
VietMX Staff asked 3 years ago

The various features of Fresh MVVM are:

  • Every Page must be associated with a Page Model
  • The PageModel can have an Init method to initialize Model variables and a ReversInit() method (a destructor) that is called when a model is popped with object
  • Page Model allows dependencies to be automatically injected into the Constructor
  • A Page must have a corresponding PageModel, with naming important so an ImagePageModel must have an ImagePage
  • PageModel can have dependencies automatically injected into the Constructor
  • The navigation in Fresh MVVM takes place between Page Models.
  • Supports automatic wiring of BindingContext
  • Supports automatic wiring of Page events (eg. appearing)
  • FreshMvvm comes with a built-in Inversion of Control Container
  • Page Model Important Methods:
    • Init(): The Init() method is called when the page is about to be loaded. User can pass an “object” to this method to allow setting up the Page with external data before it is being loaded
    • ReversInit(): The ReverseInit()  method is called when the page I about to be popped from the stack. It allows returning an “object” which can contain the data returned by the Page
    • ViewIsDisappearing(): ViewisDisappearing() is called when the view is about to disappear from the screen
    • ViewIsAppearing(): ViewisIsAppearing() is called when the view is about to appear on the screen.