Splat.ReactiveUIExtensions
1.0.2
dotnet add package Splat.ReactiveUIExtensions --version 1.0.2
NuGet\Install-Package Splat.ReactiveUIExtensions -Version 1.0.2
<PackageReference Include="Splat.ReactiveUIExtensions" Version="1.0.2" />
paket add Splat.ReactiveUIExtensions --version 1.0.2
#r "nuget: Splat.ReactiveUIExtensions, 1.0.2"
// Install Splat.ReactiveUIExtensions as a Cake Addin #addin nuget:?package=Splat.ReactiveUIExtensions&version=1.0.2 // Install Splat.ReactiveUIExtensions as a Cake Tool #tool nuget:?package=Splat.ReactiveUIExtensions&version=1.0.2
Splat.ReactiveUIExtensions
Add constructor injection to splat and add methods to register all views and viewmodels in an assembly You can install the nuget package "Splat.ReactiveUIExtensions" to get started
Register all your views and viewmodels on startup:
Instead of Locator.CurrentMutable.Register(() ⇒ new UpcomingMoviesListView(), typeof(IViewFor<UpcomingMoviesListViewModel>)); Locator.CurrentMutable.Register(() ⇒ new UpcomingMoviesCellView(), typeof(IViewFor<UpcomingMoviesCellViewModel>)); Locator.CurrentMutable.Register(() ⇒ new MovieDetailView(), typeof(IViewFor<MovieDetailViewModel>));
You can now do Locator.CurrentMutable.RegisterViewsAndViewModels<ViewModelBase>(typeof(AppBootstrapper).Assembly);
The first parameter is the assembly where your views and viewmodels reside, the generic parameter is the base class for your viewmodels. The given assembly will be scanned for viewmodels by looking if there are types defined that are are derived from the generic parameter TBaseViewModelType. The views are registered by checking if there are types implementing IViewFor by default. There is also an overload for RegisterViewsAndViewModels where you can pass in the base class for views.
There are also methods to register views (RegisterViews, duh) and register viewmodels (hmm, RegisterViewModels) if you wish to have some more control from your code in how things are scanned and registered.
Constructor injection
If you use the extension methods in this library to register your classes in splat, it will use dependency injection by default for the class constructors. These methods are:
- RegisterLazySingleton
- RegisterType
The singletons are always lazy when registering them with dependency injection enabled, since it needs all dependencies to be registered to be able to construct an instance of it.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.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 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- ReactiveUI (>= 9.12.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.