reactiveui / Sextant

A ReactiveUI navigation library for Xamarin.Forms
MIT License
160 stars 26 forks source link

feature: Add NavigateForResult #52

Open ghost opened 5 years ago

ghost commented 5 years ago

I want to have a reusable viewmodel that can emit results back to the calling viewmodel.

If we can get something like a NavigateForResult with a generic type then that would be neat. Interactions are great but I believe they are best for very simple dialogs and simple results. What about a complex object? What if it's prompted as a popup, but as a full page? Yes we can subscribe to events from the ViewModel before passing it through to Navigate.Execute() but that just returns a IRoutableViewModel object and will make the pipeline less neat :D

ChooseContacts = ReactiveCommand.CreateFromObservable(() =>
    HostScreen.Router.NavigateForResult.Execute(new ContactsResultViewModel())
        .Select(contacts => /* transform result */));

We can do it by making a generic IRoutableViewModel<TResult> so the routing commands can listen to it's result.

open-collective-bot[bot] commented 5 years ago

Hey @vjlomocso :wave:,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider backing us.

https://opencollective.com/reactiveui

PS.: We offer priority support for all backers. Don't forget to add priority label when you start backing us :smile:

ReactiveUI - Open Collective
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms!
open-collective-bot[bot] commented 5 years ago

Hey @vjlomocso :wave:,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider backing us.

https://opencollective.com/reactiveui

PS.: We offer priority support for all backers. Don't forget to add priority label when you start backing us :smile:

ReactiveUI - Open Collective
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms!
glennawatson commented 5 years ago

Sextant is where our navigation is going in the future. Thanks for the suggestion