Skip to content

RoutedViewHost class

Attributes: [RequiresUnreferencedCode("This method uses reflection to determine the view model type at runtime, which may be incompatible with trimming.")] [RequiresDynamicCode("If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")]

Defined in

Namespace: ReactiveUI Assembly: ReactiveUI.dll Full name: ReactiveUI.RoutedViewHost Modifiers: public

Summary

View source

A ReactiveNavigationController that observes a RoutingState and mirrors its navigation stack into UIKit.

Applies to

net10.0-ios26.0, net10.0-maccatalyst26.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net10.0-windows10.0.19041, net9.0-ios18.0, net9.0-windows10.0.19041, net9.0-windows10.0.19041, net9.0-maccatalyst18.0, net9.0-tvos18.0, net8.0-windows10.0.19041, net8.0-macos15.0, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-tvos18.0, net462, net481

Class hierarchy
classDiagram
class RoutedViewHost
class ReactiveNavigationController
ReactiveNavigationController <|-- RoutedViewHost

Inherits from: ReactiveNavigationController

Remarks

Use RoutedViewHost inside iOS or Mac Catalyst applications to keep push/pop transitions aligned with RoutingState changes. The host resolves views via ViewLocator and updates titles using UrlPathSegment so navigation remains consistent across app restarts.

Setting Router subscribes the host to Navigate, NavigateBack, and collection change notifications. Manual calls to PushViewController and PopViewController also update the router so that imperative navigation cannot desynchronize the stacks.

Provide a ViewContractObservable when multiple views are registered for the same view model. The host will pass the latest contract to ViewLocator so that platform-specific or modal presentations render the correct view controller.

Examples

<![CDATA[
 var host = new RoutedViewHost
 {
 Router = shell.Router,
 ViewLocator = locator,
 ViewContractObservable = shell.WhenAnyValue(x => x.SelectedContract)
 };
 
 shell.Router.Navigate.Execute(new DashboardViewModel(shell)).Subscribe();
 ]]>

Constructors

NameSummary
.ctorInitializes a new instance of the [RoutedViewHost](# class.

Properties

NameSummary
RouterGets or sets the [RoutingState](# responsible for driving the navigation stack. Assigning a router wires the host up to all navigation observables.
ViewContractObservableGets or sets the observable contract used when resolving views. When null, the default contract is applied.
ViewLocatorGets or sets the [IViewLocator](# used to translate [IRoutableViewModel](# instances into UIKit view controllers. Defaults to...

Methods

NameSummary
PushViewController
PopViewController
Dispose
Inherited members