Question: How can I present a modal view on iOS using MvvmCross?

Using Xamarin Studio on iOS and the MvvmCross NuGet version 4.2.2, none of the `MvxModalSupportTouchViewPresenter`, `MvxModalNavSupportTouchViewPresenter` or `IMvxModalTouchView` are even available.

Does the ViewModel even need to know about the fact that a particular view is presented as a modal view on iOS?

Answer: 
MvvmCross is a strong Page navigation framework. Default navigation using `ShowViewModel<AViewModel>` will use the *stack* metaphor: one on top of another on Android, slide atop each other on iOS, and use `<` on either platform to go back.

You can tell the `ViewPresenter` that a given view is modal by giving it a hint, in the form of an interface marker, by adopting `IMvxModalIosView`.

### At the View Level

Adopt the `IMvxModalIosView` protocol:

```cs
public partial class AView : MvxViewController, IMvxModalIosView

```

### At the AppDelegate Level

Replace `var setup = new Setup(this, Window)` by:

```cs
var presenter = new MvxModalSupportIosViewPresenter(this, Window);
var setup = new Setup(this, presenter);
setup.Initialize();

```

### At the ViewModel Level

No change required. The ViewModel is actually not made aware of the modal presentation. Invoke:

```cs
ShowViewModel<AViewModel> // May be modal on certain platforms

```

---

To close a Page and go back to the previous one, regardless of your presentation style, use `Close(this)` on that very ViewModel. This will *close* a modal dialog, or *pop* a pushed view. A complete, bindable `ICommand` may look like this:

```cs
public ICommand BackCommand {
    get { return new MvxCommand(() => Close(this)); }
}

```

**Notes**: In MvvmCross 4.2.2, *Touch* has been renamed *iOS*, so `IMvxModalTouchView` is now `IMvxModalIosView`. The new `using` are:

* `using MvvmCross.iOS.Platform;`
* `using MvvmCross.iOS.Views.Presenters;`
Using MvvmCross 5.5.2 all I had to get a modal was to add the following MvxModalPresentation attribute to my iOS view:

```
[Register("ExampleModalView")]
    [MvxModalPresentation(
        ModalPresentationStyle = UIModalPresentationStyle.PageSheet,
        ModalTransitionStyle = UIModalTransitionStyle.CoverVertical     
    )]
    public class ExampleModalView : MvxViewController
    {
        public ExampleModalView() {

        }
     ...
}

```

Launching the modal is simple with the IMvxNavigationService service

```
        await _navigationService.Navigate<ExampleModalViewModel>();

```

ExampleModalViewModel just needs to be a plain MvvmCross view model inheriting from MvxViewModel.

A useful reference for this is ModalView.cs in the iOS playground project: <https://github.com/MvvmCross/MvvmCross/blob/develop/TestProjects/Playground/Playground.iOS/Views/ModalView.cs#L12>