Reputation: 606
I try to understand how Xamarin.iOS (MonoTouch) and Xamarin.Android (Mono for Android) work. I wrote a little App and looked into the .app and .apk file.
Inside of the .app file (iOS) are many .dll files. But why? On every page and post I read they say: The App is executed native and nothing is interpreted. Can somebody explain to me what the xamarin developer mean with "native"?
Inside of the .apk file is not a single .dll file..
Upvotes: 29
Views: 14230
Reputation: 902
First of all, Xamarin works on two different runtimes at same time:
Some example. When you are creating your own C# class in Visual Studio, instance of this class will run under Mono. Also when you are downloading Newton.Json package from nuget, this will run in Mono too. This is reason why we can use all cool .NET stuff. However, when you are inheriting from Java.Lang.Object (Android) or NSObject (iOS) or making a custom controll, instances of these classes will run under native runtime.
Second of all, you can noticed that we need bind these two worlds somehow. Let's have a look what type of objects do we have.
Peer objects it's instances of Xamarin SDKs classes (for example activities, view controls, UILabels, TextViews and so on), instances of your own inheriting from Java.Lang.Object, NSObject, Fragment or even UISegment classes.
That mechanism is one of most important things from Xamarin.
PS: Actually, it does not matter which of compilation do we use for Xamarin projects JIT or AOT. It depends on platform and allows / not allows some features from .NET world. That does not describe how Xamarin works.
Upvotes: 4
Reputation: 63133
The Xamarin definition of "native" includes but is not limited to:
http://www.mono-project.com/AOT
(Note that Xamarin.Android still uses JIT, http://xamarin.com/how-it-works)
Access to platform native types / API is fully open, so you are not limited to a small set of API calls (if you use HTML5 / JavaScript, you know what kind of limitations are there).
The user interface you design is bound to the native API exposed by iOS (CocoaTouch) or Android (Skia). There is no intermediate layer to hurt performance or look and feel.
As to what is inside .ipa or .apk, who cares? Of course @Jason's comment shows us of some internal implementation details.
Upvotes: 10
Reputation: 163
The Xamarin compiler bundles the .NET runtime and outputs a native (binary) ARM executable, packaged as an iOS or Android app.
Upvotes: 1