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¶
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¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [RoutedViewHost](# class. |
Properties¶
| Name | Summary |
|---|---|
| Router | Gets or sets the [RoutingState](# responsible for driving the navigation stack. Assigning a router wires the host up to all navigation observables. |
| ViewContractObservable | Gets or sets the observable contract used when resolving views. When null, the default contract is applied. |
| ViewLocator | Gets or sets the [IViewLocator](# used to translate [IRoutableViewModel](# instances into UIKit view controllers. Defaults to... |
Methods¶
| Name | Summary |
|---|---|
| PushViewController | |
| PopViewController | |
| Dispose |
Inherited members
ReactiveUI.ReactiveNavigationController.#ctor(UIKit.UIViewController)ReactiveUI.ReactiveNavigationController.#ctor(System.Type,System.Type)ReactiveUI.ReactiveNavigationController.#ctor(System.String,Foundation.NSBundle)ReactiveUI.ReactiveNavigationController.#ctor(System.IntPtr@)ReactiveUI.ReactiveNavigationController.#ctor(Foundation.NSObjectFlag)ReactiveUI.ReactiveNavigationController.#ctor(Foundation.NSCoder)ReactiveUI.ReactiveNavigationController.#ctorReactiveUI.ReactiveNavigationController.SuppressChangeNotificationsReactiveUI.ReactiveNavigationController.ViewWillAppear(System.Boolean)ReactiveUI.ReactiveNavigationController.ViewDidDisappear(System.Boolean)ReactiveUI.ReactiveNavigationController.Dispose(System.Boolean)ReactiveUI.ReactiveNavigationController.ChangingReactiveUI.ReactiveNavigationController.ChangedReactiveUI.ReactiveNavigationController.ThrownExceptionsReactiveUI.ReactiveNavigationController.ActivatedReactiveUI.ReactiveNavigationController.DeactivatedReactiveUI.ReactiveNavigationController.PropertyChangingReactiveUI.ReactiveNavigationController.PropertyChangedSystem.Object.Equals(System.Object)System.Object.Equals(System.Object,System.Object)System.Object.GetHashCodeSystem.Object.GetTypeSystem.Object.MemberwiseCloneSystem.Object.ReferenceEquals(System.Object,System.Object)System.Object.ToString