This project is part of the ChilliSource framework developed by BlueChilli.
ChilliSource.Mobile.Ioc
provides a DryIoc based dependency resolver for the Splat Service Locator.
var container = new Container();
container.Register<ITestInterface, ImpTestClassObject>();
container.Register<ParentObject, ParentObject>();
container.Register<ChildObject, ChildObject>();
For more information please read the DryIoc Documentation
container.UseDryIocDependencyResolver();
Locator.CurrentMutable.Register(() => new ChildObject(), typeof(ChildObject));
For more information please read the Splat Documentation
The following code will register all views in the assembly that implement ReactiveUI's IViewFor<T>
interface:
var assembly = typeof(HomePageViewModel).Assembly;
container.RegisterViews(assembly);
container.UseDryIocDependencyResolver();
Based on the MVVM convention of naming view models with the "ViewModel" suffix, the following code will search for all types suffixed with "ViewModel" in the assembly and register them in the container in order to automatically link them to their corresponding views.
var assembly = typeof(HomePageViewModel).Assembly;
container.RegisterViewModels(assembly);
container.UseDryIocDependencyResolver();
var child = Locator.Current.GetService<ChildObject>();
The libraries are available via NuGet:
See the releases.
Please see the Contribution Guide.
ChilliSource.Mobile is licensed under the MIT license.
For questions or feedback, please contact chillisource@bluechilli.com.