سؤال

I have been looking into using MvvmCross as our solution to cross platform development, with previous development being solely targeted at iOS. I have come to really like how storyboards encompass all the views together along with the flow between them.

I know Monotouch supports their usage with the storyboard projects which I have been able to work with, however I have not been able to find any reference/example to it being using with MvvmCross.

Is this currently supported? or can someone provide me some tips as to how I can get this setup. The initiation seems to be the issue as in the storyboard projects the FinishedLaunching method in the AppDelegate is usually empty

هل كانت مفيدة؟

المحلول

Is this currently supported?

I don't believe it is.

I've never used Storyboards to build anything other than a demo app - so I'm not an expert.

However, from what I know I think there are 3 problems that you would need to overcome.

1. Storyboards don't have code in FinishedLaunching

This is easy to solve I think - you can just add an override to FinishedLaunching which calls an MvvmCross Setup class in order to initialise IoC, Plugins, your App, etc.

2. MvvmCross vNext requires you to override the constructors to forms like

public DetailViewController (MvxShowViewModelRequest request) {
}

while Storyboards require the use of forms like:

public DetailViewController (IntPtr handle) {
}

Overcoming this is harder... but the good news is that it should be a lot easier in v3 - one of the stated aims of v3 is to somehow support storyboards - see http://slodge.blogspot.co.uk/2013/02/mvvmcross-v3.html

3. Clash of concepts

If you are using Storyboards, then the navigation logic is tied to the Storyboard and to the UIViewController.

If you are using MvvmCross, then the navigation logic is tied to the ViewModels.

Overcoming this would be relatively straight-forward - you can easily mix and match concepts - but you might find your ViewModels and Views feeling 'a bit odd' as a result.


Summary

Doing this today is possible but would require some hours of hacking.

A beta of v3 is due very soon (within weeks - just depends on my spare time). Once that is available I think you'd be able to get started much quicker.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top