Introducing the Xamarin.iOS Interpreter
Historically iOS applications have had a number of limitations when running on a device, as Apple disallows the execution of dynamically generated code. Applications are compiled “Ahead of Time” (AOT) before deployment because of this. You can read more about this architecture here.
“Ahead of Time” AOT
In most cases, AOT can provide performance benefits. It can also restrict a number of C# features from being used:
- Some uses of the C# dynamic feature
The team has been hard at work at overcoming these limitations while abiding by platform restrictions. The result is a new interpreter for Xamarin.iOS.
Today we are promoting this experimental work into a preview ready for general testing.
The Interpreter, as the name implies, allows you to interpret at run time some C# parts of your application while compiling the rest ahead of time as usual. Get started previewing by installing the packages below:
Once you have the preview installed (don’t forget your Mac build host), you can enable the interpreter by:
- Opening the project’s options
- Switch to iOS Build
--interpreterto the Additional mtouch arguments.
We have some small samples available which show off some of the new functionality.
- [mono] No 32bits support (impact iOS and watchOS)
- [mono] No IL is stripped when the interpreter is enabled (even for AOT’ed code) which makes applications larger than they need to be
Try It Out!
Please take the new interpreter for a spin and provide feedback here: https://github.com/xamarin/xamarin-macios/issues/new