Search code examples
xamarinxamarin.formsprismnavigationservicefreshmvvm

Xamarin Forms IoC containter + navigation service


  1. Does Xamarin.Forms have a built-in IoC navigation service? I mean something like Prism, where you could register your routes.
  2. If yes - where is the documentation?
  3. If not - will Xamarin.Forms have a built-in navigation service in near future?
  4. Also - if not - what would be the best MVVM fw for Xamarin.Android, Xamarin.iOS, Xamarin.WinXYZ and Xamarin.Forms? And why?

It seems to me that it comes down to battle between Prism and FreshMVVM - this brings me to my most important questions:

  1. Which of these two is performing better? (Which one is faster?)
  2. Which of these is more likely to lead the way of MVVM frameworks considering mobile development in the future?

Solution

  • No Xamarin Forms does not offer navigation like Prism. They had a goal of making the built in Navigation similar to Prism, but that has since disappeared from their roadmap. There is also no direct IoC concept built directly into Xamarin Forms.

    If you are developing native UI's then Prism probably isn't for you as it is purpose built for Xamarin Forms. In that case I might say you should look at MvvmCross. It is battle tested in a lot of classic Xamarin apps.

    If however you are developing with Xamarin Forms, then Prism would be the best to use. My opinion may be biased, but it's also the public opinion of many of those on the Xamarin team. Remember Prism was originally started by the Microsoft Patterns and Practices team. While Prism for Xamarin Forms was started after that, the foundation of what Prism is and how it works, helps keep developers developing using proper MVVM patterns.