Git Product home page Git Product logo

sextant's Introduction

Sextant

NuGet Stats Build Status Code Coverage

Sextant

A ReactiveUI navigation library for Xamarin.Forms

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 (especially the build.cake) from where learned a lot about Cake + AppVeyor

Usage

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

Register the views:

SextantHelper.RegisterView<HomeView,HomeViewModel>();
SextantHelper.RegisterView<FirstModalView,FirstModalViewModel>();
SextantHelper.RegisterView<SecondModalView, SecondModalViewModel>();
SextantHelper.RegisterView<RedView, RedViewModel>();

(optional)If you need some especial configuration on the Navigation, like diferent colors, register a NavigationView for the VM:

SextantHelper.RegisterNavigation<BlueNavigationView, SecondModalViewModel>();

Set the initial page:

MainPage = SextantHelper.Initialize<HomeViewModel>();

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);

For example:

OpenModal = ReactiveCommand
    .CreateFromObservable(() =>
        this.ViewStackService.PushModal(new FirstModalViewModel(ViewStackService)),
        outputScheduler: RxApp.MainThreadScheduler);

For more examples, look inside the sample folder in the solution.

Contribute

Sextant is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use. Because of our Open Collective model for funding and transparency, we are able to funnel support and funds through to our contributors and community. 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:

sextant's People

Contributors

giusepe avatar rlittlesii avatar glennawatson avatar worldbeater avatar devqasm avatar reallinfo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.