Sextant 2.12.120
Prefix ReservedSee the version list below for details.
dotnet add package Sextant --version 2.12.120
NuGet\Install-Package Sextant -Version 2.12.120
<PackageReference Include="Sextant" Version="2.12.120" />
paket add Sextant --version 2.12.120
#r "nuget: Sextant, 2.12.120"
// Install Sextant as a Cake Addin #addin nuget:?package=Sextant&version=2.12.120 // Install Sextant as a Cake Tool #tool nuget:?package=Sextant&version=2.12.120
Sextant
<p align="left"><img src="https://github.com/reactiveui/styleguide/blob/master/logo_sextant/vertical.png?raw=true" alt="Sextant" height="180px"></p>
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 | |
Xamarin.Forms | Sextant.XamForms | |
Xamarin.Forms | Sextant.Plugins.Popup | |
Xamarin.iOS | Sextant | |
Avalonia | Sextant.Avalonia |
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:
- Responding to questions on StackOverflow
- Passing on knowledge and teaching the next generation of developers
- Submitting documentation updates where you see fit or lacking.
- Making contributions to the code base.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows10.0.17763 is compatible. net6.0-windows10.0.19041 is compatible. net7.0 is compatible. net7.0-android was computed. net7.0-android33.0 is compatible. net7.0-ios was computed. net7.0-ios16.1 is compatible. net7.0-maccatalyst was computed. net7.0-maccatalyst16.1 is compatible. net7.0-macos was computed. net7.0-macos13.0 is compatible. net7.0-tvos was computed. net7.0-tvos16.1 is compatible. net7.0-windows was computed. net7.0-windows10.0.17763 is compatible. net7.0-windows10.0.19041 is compatible. net8.0 is compatible. net8.0-android was computed. net8.0-android34.0 is compatible. net8.0-browser was computed. net8.0-ios was computed. net8.0-ios17.2 is compatible. net8.0-maccatalyst was computed. net8.0-maccatalyst17.2 is compatible. net8.0-macos was computed. net8.0-macos14.2 is compatible. net8.0-tvos was computed. net8.0-tvos17.2 is compatible. net8.0-windows was computed. net8.0-windows10.0.17763 is compatible. net8.0-windows10.0.19041 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. monoandroid13.0 is compatible. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. xamarinios10 is compatible. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. xamarintvos10 is compatible. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
.NETFramework 4.7.2
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
.NETStandard 2.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
MonoAndroid 13.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net6.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net6.0-windows10.0.17763
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net6.0-windows10.0.19041
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net7.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net7.0-android33.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net7.0-ios16.1
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net7.0-maccatalyst16.1
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net7.0-macos13.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net7.0-tvos16.1
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net7.0-windows10.0.17763
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net7.0-windows10.0.19041
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net8.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net8.0-android34.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net8.0-ios17.2
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net8.0-maccatalyst17.2
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net8.0-macos14.2
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net8.0-tvos17.2
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net8.0-windows10.0.17763
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
net8.0-windows10.0.19041
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
Xamarin.iOS 1.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
-
Xamarin.TVOS 1.0
- ReactiveUI (>= 19.5.39)
- System.Collections.Immutable (>= 8.0.0)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Sextant:
Package | Downloads |
---|---|
Sextant.XamForms
A ReactiveUI navigation library for Xamarin.Forms |
|
Sextant.Maui
A ReactiveUI navigation library for Xamarin.Forms |
|
Community.Sextant.WinUI
A ReactiveUI navigation library for WinUI 3. |
|
Community.Sextant.WinUI.Microsoft.Extensions.DependencyInjection
An adapter for Microsoft.Extensions.DependencyInjection for Community.Sextant.WinUI. |
|
Sextant.Avalonia
A ReactiveUI navigation library for Xamarin.Forms |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.1 | 1,306 | 5/27/2024 |
2.12.162 | 239 | 5/26/2024 |
2.12.120 | 2,475 | 1/25/2024 |
2.12.113 | 965 | 12/9/2023 |
2.12.112 | 253 | 12/9/2023 |
2.12.4 | 13,751 | 5/19/2021 |
2.12.3 | 534 | 5/18/2021 |
2.11.1 | 12,516 | 2/28/2021 |
2.10.1 | 7,588 | 1/22/2021 |
2.9.5 | 745 | 12/31/2020 |
2.9.4 | 655 | 12/28/2020 |
2.9.1 | 2,962 | 12/16/2020 |
2.8.1 | 1,063 | 11/5/2020 |
2.7.1 | 3,238 | 6/6/2020 |
2.6.1 | 841 | 5/8/2020 |
2.5.8 | 1,177 | 3/5/2020 |
2.5.1 | 1,263 | 1/6/2020 |
2.4.1 | 949 | 12/12/2019 |
2.3.9 | 750 | 12/5/2019 |
2.3.7 | 664 | 11/28/2019 |
2.3.1 | 692 | 11/21/2019 |
2.2.2 | 3,575 | 9/16/2019 |
2.2.1 | 719 | 9/6/2019 |
2.1.1 | 863 | 8/28/2019 |
2.0.6 | 752 | 8/24/2019 |
2.0.1 | 1,276 | 7/26/2019 |
1.5.5 | 1,270 | 3/20/2019 |
1.4.0 | 1,381 | 8/16/2018 |
1.4.0-unstable0003 | 718 | 8/16/2018 |
1.4.0-unstable0002 | 727 | 8/16/2018 |
1.3.0 | 3,155 | 7/20/2018 |
1.1.0-unstable0007 | 1,368 | 6/7/2018 |
1.1.0-unstable0006 | 904 | 6/7/2018 |
1.1.0-unstable0005 | 861 | 6/7/2018 |
1.1.0-unstable0004 | 847 | 6/6/2018 |
1.1.0-unstable0001 | 833 | 6/1/2018 |
0.4.0-unstable0004 | 919 | 6/1/2018 |
0.4.0-unstable0003 | 910 | 5/21/2018 |
0.4.0-unstable0002 | 886 | 4/16/2018 |
0.4.0-unstable0001 | 835 | 4/16/2018 |
0.3.4 | 1,073 | 4/16/2018 |
0.3.0-unstable0018 | 860 | 4/16/2018 |