Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

What's the cleanest way to reuse ViewModels across iOS and Android?

$
0
0

I'm using MvvmCross, and I've got a complete working app in Android. I'm using the NavigationDrawer and am loading Fragments into the FrameLayout. Essentially something like this

  • PCL

    • ViewModels
      • HomeViewModel
      • AudioPlayerFragmentViewModel
      • LoginFragmentViewModel
  • Droid.Ui

    • Fragments
      • AudioPlayerFragment
      • LoginFragment
    • Views
      • HomeView <-- only one View as the entry point to the app. Everything else is fragmented.

Now I need to build out my iOS app, and reuse my ViewModels in the PCL, and (preferably) not create a custom View/ViewModel for the Menu. I'm using SlidingPanels for my iOS "version" of the Navigation Drawer, and the tutorials I'm seeing are requiring an additional View/ViewModel for the menu.

Is there any way to do this and keep continuity with regards to ViewModels so that they can all be reused in a PCL? Is there a nice (read Clean) way to build the layout structure in a similar way to Android? For some bizarre reason, I simply can't wrap my head around the iOS UI. It feels so very foreign to me in comparison to Android.


Viewing all articles
Browse latest Browse all 204402

Trending Articles