Porting existing C# libraries
Even though Xamarin is becoming a popular platform, many open-source .NET libraries are simply not up to speed with supporting Xamarin.iOS
and Xamarin.Android
. But in these cases, you are definitely not out of luck. Often, if there is a Silverlight or Windows Phone version of the library, you can simply create an iOS or Android class library and add the files with no code changes.
To illustrate this process, let's port an open source project that doesn't have Xamarin or portable class library support. I have selected a dependency injection library called Ninject, due to its usefulness and relationship to ninjas. Find out more about the library at http://www.ninject.org/.
Let's begin setting up the library to work with Xamarin projects as follows:
First, download the source code for Ninject from https://github.com/ninject/ninject.
Create a new solution with an iOS Class Library project named
Ninject.iOS
.Link in all the files from the
Ninject
main project. Make sure...