I'm happy to announce Ninject support for Xamarin.iOS and Xamarin.Android. Together with the previous release, which included support for Universal Apps, Ninject now supports every major platform in a single Portable.Ninject NuGet package.
Not being enough to simply support each platform, the Portable.Ninject package includes a Portable Class Library (PCL) reference assembly so you can reference Ninject in your PCL's. Just make sure to also add the NuGet reference to your main application so the "real" bits get used instead of the reference assemblies. This means it's easy to have
NinjectModule's in your portable code.
To get started
- Add the
Portable.Ninjectpackage to your project.
- If your project is a PCL, also add the package to your main app.
- Somewhere in your main app, usually your App class (Windows), AppDelegate (iOS), or Application class (Android), create the
Kerneland load your types/modules.
This package just has the core Ninject functionality. Much of Ninject's power comes from its extensions, including Convention Based Binding and Factory. These extensions have not yet been forked and updated to work with
Portable.Ninject, but they shouldn't be hard to do. Please drop a note to let me know which extensions you'd like to see brought over.
Contributions are very much welcome! Please clone/fork my repo and use the
bait-switch branch as your starting point. The solution contains unit test projects for all platforms; to run the xUnit ones for Wpa81 or Win8, you'll need the latest xUnit runner for Visual Studio extension installed too.