Xamarin Forms IoC containter + navigation service

521 Views Asked by At
  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?
2

There are 2 best solutions below

4
On BEST ANSWER

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.

0
On

Question 1: Yes, Xamarin.Forms have a built-in navigation service.

Question 2: Xamarin.Forms navigation

Edit 2 for question 1: No, there is no IoC Navigation built in Xamarin.Forms framework.

But if you want some IoC navigation maybe this a good one: Xamarin Forms - View Model First Navigation avoiding big frameworks like Prism, MVVMLight or MVVMCross. If not this frameworks works well for this purpose.