locked
Sample for Xamarin iOS project with MVVM pattern RRS feed

  • Question

  • User141017 posted

    Can you please provide me a sample for xamarin.ios with mvvm design pattern. I am seeing only forms example and I want to use the pattern in native iOS

    Wednesday, April 24, 2019 2:31 PM

Answers

  • User254340 posted

    Xamarin.iOS uses the Mvc pattern as a default, but there are plenty of frameworks that allow you to use the Mvvm pattern in native Xamarin. (It is increasingly becoming the preferred style anyway). MvvmCross is one of the more popular ones...

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, April 29, 2019 3:08 PM

All replies

  • User369978 posted

    Only Xamarin.Forms uses MVVM pattern , Xamarin.iOS uses MVC like native iOS.

    Thursday, April 25, 2019 5:32 AM
  • User254340 posted

    Xamarin.iOS uses the Mvc pattern as a default, but there are plenty of frameworks that allow you to use the Mvvm pattern in native Xamarin. (It is increasingly becoming the preferred style anyway). MvvmCross is one of the more popular ones...

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, April 29, 2019 3:08 PM
  • User254340 posted

    Just to clarify, @ColeX is right, out of the box Xamarin.iOS/Android both use the MVC pattern (just like Swift/ObjC). It's becoming increasingly less popular to follow the MVC pattern (especially in larger applications), and this is where third party open source projects like MvvmCross come in.

    Projects like MvvmCross allow full access to the native API's of every platform, so it's still possible to implement custom navigation/presenters etc.

    Wednesday, May 8, 2019 1:32 PM
  • User205607 posted

    @VamsiValiveru This Xamarin Native sol'n uses MvvmCross:

    https://github.com/mikeacosta/mvx-custom-binding

    It currently only has a Xamarin.Android project, as well as the shared Core project, but a Xamarin.iOS project could be added, and the iOS Setup class would be modified to derive from MvxIosSetup<App>.

    Feel free to clone that repo, add an iOS projects and run it - a great way to learn. :smile:

    Here's another example:

    https://www.mvvmcross.com/documentation/tutorials/tipcalc/a-xamarinios-ui-project

    Wednesday, May 8, 2019 4:48 PM