-1

I am using mvvmcross pattern. I have a list of datasets. I am showing only one dataset on the view. When user swipes either left or right, then I need to reload the view to show corresponding dataset.

My dataset is big (around 100), I am afraid to use viewpager, it might be an issue in terms of memory.

I have used the following approach before Android: How to handle right to left swipe gestures, but I wonder how to detect/implement swipe gesture in mvvmcross ?

Community
  • 1
  • 1
casillas
  • 16,351
  • 19
  • 115
  • 215
  • Looks like you are trying to re-invent the wheel here. For your scenario I believe using a view pager with `FragmentStatePagerAdapter` is the better choice since it automatically destroys views that are not visible and recreate them when they are about to become visible again. Hence there is less memory consumption. – Much Overflow Mar 16 '16 at 16:31
  • Thing is, you don't really implement swipe gesture for mvvmcross. If you need swipes, the best solution, is to implement a native way to do what you want, and when the swipe is correctly detected in your Platform-specific code, then you manually trigger a command in your viewmodel. What is handled by the MvvmCross Framework is "abstract" as it is only the intelligence of your app. Gestures are more of a UI feature, so to be implemented on each platform – Miiite Mar 19 '16 at 18:33
  • Do you have an example of your approach? – casillas Mar 21 '16 at 22:03

1 Answers1

2

Swipe gestures are a View concern and are generally not implemented in a MVVM framework. MvvmCross has a Tap gesture recognizer for iOS only.

So since it is a View concern you should look at how this is done natively on Android.

Cheesebaron
  • 24,131
  • 15
  • 66
  • 118