Is it possible to embed xamarin part into an exist

2019-02-22 19:34发布

问题:

I have existing iOS and Android native apps. Is it possible to extend the apps with Xamarin coded part ?

回答1:

Both Xamarin.iOS and Xamarin.Android are currently setup to take control of your application, so you need to make your main program be written in C# and then call into the existing code.

The way that you would do this is to bind your existing Objective-C or Java code as C# libraries, and then consume those libraries from C#. The binding technology is precisely what drives both the Xamarin.iOS and Xamarin.Android tools, so you would effectively be doing the same.

Once you have bindings, the interoperability works both ways: you can call native code, and native code can call C#.

The bad news is that instead of starting to enjoy writing code with both tools from day zero, the first thing you have to do the bindings, which is in general, not as fun as watching colored squared move on your screen.



回答2:

Ok I find an answer here : http://www.whitneyland.com/2013/05/why-i-dont-recommend-xamarin-for-mobile-development.html

For example, code written in Xamarin cannot be used in native or HTML5 apps.