Forum Xamarin.iOS

Sample for Xamarin iOS project with MVVM pattern

VamsiValiveruVamsiValiveru USMember ✭✭

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

Best Answer

Answers

  • ColeXColeX Member, Xamarin Team Xamurai
    edited April 2019

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

  • FinHorsleyFinHorsley USMember ✭✭

    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.

  • mikeacostamikeacosta USUniversity ✭✭✭

    @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

Sign In or Register to comment.