All Projects → reactiveui → Sextant

reactiveui / Sextant

Licence: MIT License
A ReactiveUI navigation library for Xamarin.Forms

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Sextant

codemill.vmfirstnav
Xamarin.Forms ViewModel First Navigation Library
Stars: ✭ 22 (-82.26%)
Mutual labels:  xamarin, navigation
Xam.plugin.simplebottomdrawer
Just a nice and simple BottomDrawer for your Xamarin Forms project
Stars: ✭ 92 (-25.81%)
Mutual labels:  xamarin, navigation
XamFormsVMNav
Xamarin Forms ViewModel First Navigation
Stars: ✭ 22 (-82.26%)
Mutual labels:  xamarin, navigation
Customnavigationbarsample
Navigation Bar Customization in Xamarin Forms
Stars: ✭ 104 (-16.13%)
Mutual labels:  xamarin, navigation
Reactiveui
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
Stars: ✭ 6,709 (+5310.48%)
Mutual labels:  xamarin, reactiveui
Xamarin.forms.breadcrumb
This is a breadcrumb navigation control that is complete automatic and uses the Navigation stack and page titles to generate the breadcrumbs.
Stars: ✭ 130 (+4.84%)
Mutual labels:  xamarin, navigation
FicusUIChallenge
Xamarin.Forms UI Challenge Ficus IoT App
Stars: ✭ 38 (-69.35%)
Mutual labels:  xamarin
react-native-template
A template for react native applications with built-in navigation.
Stars: ✭ 37 (-70.16%)
Mutual labels:  navigation
neonavigation
A 2-D/3-DOF seamless global/local mobile robot motion planner package for ROS
Stars: ✭ 199 (+60.48%)
Mutual labels:  navigation
ButtonCirclePlugin
Circle Buttons with icon for your Xamarin.Forms Applications
Stars: ✭ 96 (-22.58%)
Mutual labels:  xamarin
souyuz
Fastlane build plugin for building Xamarin.iOS and Xamarin.Android applications
Stars: ✭ 35 (-71.77%)
Mutual labels:  xamarin
go router
The purpose of the go_router for Flutter is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.
Stars: ✭ 380 (+206.45%)
Mutual labels:  navigation
Rox.Video.Xamarin
Rox Video Control for Xamarin.Forms
Stars: ✭ 17 (-86.29%)
Mutual labels:  xamarin
vor-python-decoder
Decodes VOR signal from WAV file to get the bearing to your position
Stars: ✭ 33 (-73.39%)
Mutual labels:  navigation
RustRobotics
Rust implementation of PythonRobotics such as EKF, DWA, Pure Pursuit, LQR.
Stars: ✭ 40 (-67.74%)
Mutual labels:  navigation
Helm
A graph-based SwiftUI router
Stars: ✭ 64 (-48.39%)
Mutual labels:  navigation
docsify-pagination
↔️ Pagination for docsify
Stars: ✭ 80 (-35.48%)
Mutual labels:  navigation
NavKit
Simple and integrated way to customize navigation bar experience on iOS app.
Stars: ✭ 37 (-70.16%)
Mutual labels:  navigation
fdplugin-quicknavigate
Quick Navigate Plugin for FlashDevelop/HaxeDevelop
Stars: ✭ 30 (-75.81%)
Mutual labels:  navigation
styled-off-canvas
A simple off canvas menu built with styled-components 💅
Stars: ✭ 61 (-50.81%)
Mutual labels:  navigation

Sextant

NuGet Stats Build Code Coverage

Sextant

A ReactiveUI view model based navigation library

Sextant was born from a fork of Xamvvm which is nice and simple MVVM Framework with a good navigation system. The problem is, I just wanted a simple navigation system to use with ReactiveUI without all the things that come along an MVVM framework. Plus, I wanted to make it more "Reactive Friendly".

Then a wild Rodney Littles appears, and with him an implementation of this AMAZING POST by Kent

Sextant is in a very initial stage and in constant change, so please be pantience with use... because we will break things.

This library is nothing more than me "standing on the shoulders of giants": Kent for been the original and true creator of this, I pretty much just copied and pasted it :) Geoffrey Huntley maintainer on ReactiveUI.

NuGet Installation

Install the nuget package on your Forms project and ViewModels project.

GitHub

Pre release packages are available at https://nuget.pkg.github.com/reactiveui/index.json

NuGet

Platform Sextant Package NuGet
UWP Sextant CoreBadge
Xamarin.Forms Sextant.XamForms XamBadge
Xamarin.Forms Sextant.Plugins.Popup PopupBadge
Xamarin.iOS Sextant CoreBadge
Avalonia Sextant.Avalonia CoreBadge

Target Platform Versions

Verify you have the minimum version for your target platform (i.e. Android, iOS, Tizen).

Register Components

Views

Version 2.0 added new extensions methods for the IMutableDepedencyResolver that allow you to register an IViewFor to a View Model.

Locator
    .CurrentMutable
    .RegisterNavigationView(() => new NavigationView(RxApp.MainThreadScheduler, RxApp.TaskpoolScheduler, ViewLocator.Current))
    .RegisterParameterViewStackService()
    .RegisterViewForNavigation(() => new PassPage(), () => new PassViewModel())
    .RegisterViewForNavigation(() => new ReceivedPage(), () => new ReceivedViewModel());

Set the initial page:

Locator
    .Current
    .GetService<IParameterViewStackService>()
    .PushPage<PassViewModel>()
    .Subscribe();

MainPage = Locator.Current.GetNavigationView("NavigationView");

Use the Navigation Service

After that all you have to do is call one of the methods inside your ViewModels:

/// <summary>
/// Pops the <see cref="IPageViewModel"/> off the stack.
/// </summary>
/// <param name="animate">if set to <c>true</c> [animate].</param>
/// <returns></returns>
IObservable<Unit> PopModal(bool animate = true);

/// <summary>
/// Pops the <see cref="IPageViewModel"/> off the stack.
/// </summary>
/// <param name="animate">if set to <c>true</c> [animate].</param>
/// <returns></returns>
IObservable<Unit> PopPage(bool animate = true);

/// <summary>
/// Pushes the <see cref="IPageViewModel"/> onto the stack.
/// </summary>
/// <param name="modal">The modal.</param>
/// <param name="contract">The contract.</param>
/// <returns></returns>
IObservable<Unit> PushModal(IPageViewModel modal, string contract = null);

/// <summary>
/// Pushes the <see cref="IPageViewModel"/> onto the stack.
/// </summary>
/// <param name="page">The page.</param>
/// <param name="contract">The contract.</param>
/// <param name="resetStack">if set to <c>true</c> [reset stack].</param>
/// <param name="animate">if set to <c>true</c> [animate].</param>
/// <returns></returns>
IObservable<Unit> PushPage(IPageViewModel page, string contract = null, bool resetStack = false, bool animate = true);

Example

public class ViewModel
{
    private readonly IViewStackServicen _viewStackService; // or IParameterViewStackServicen

    public ViewModel(IViewStackServicen viewStackService)
    {
        _viewStackService = viewStackService;

        OpenModal = ReactiveCommand
            // FirstModalViewModel must implement IViewModel or INavigable
            .CreateFromObservable(() => viewStackService.PushModal<FirstModalViewModel>(),
                outputScheduler: RxApp.MainThreadScheduler);
    }

    public ReactiveCommand<Unit, Unit> OpenModal { get; }
}

Pass Parameters

Version 2.0 added support for passing parameters when navigating.

Example

public class ViewModel
{
    private readonly IParameterViewStackServicen _viewStackService;

    public ViewModel(IParameterViewStackServicen viewStackService)
    {
        _viewStackService = viewStackService;

        Navigate = ReactiveCommand
            // NavigableViewModel must implement INavigable
            .CreateFromObservable(() => viewStackService.PushModal<NavigableViewModel>(new NavigationParameter { { "parameter", parameter } }),
                outputScheduler: RxApp.MainThreadScheduler);
    }

    public ReactiveCommand<Unit, Unit> Navigate { get; }
}

The INavigable interface exposes view model lifecycle methods that can be subscribed to. These methods unbox your parameter object. Implementing the interface allows you to assign values to the View Model during Navigation.

public class NavigableViewModel : INavigable
{
        public string? _parameter;

        public IObservable<Unit> WhenNavigatedFrom(INavigationParameter parameter)
        {
            return Observable.Return(Unit.Default)
        }

        public IObservable<Unit> WhenNavigatedTo(INavigationParameter parameter)
        {
            parameter.TryGetValue("parameter", out _parameter);
            return Observable.Return(Unit.Default);
        }

        public IObservable<Unit> WhenNavigatingTo(INavigationParameter parameter)
        {
            return Observable.Return(Unit.Default);
        }
}

Samples

Contribute

Sextant is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use. We the people who are involved in this project, and we’d love to have you on board, especially if you are just getting started or have never contributed to open-source before.

So here's to you, lovely person who wants to join us — this is how you can support us:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].