Introducing the Xamarin.iOS Interpreter

Chris

March 26th, 2019

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:

Assembly.Load and System.Reflection.Emit

and 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.

The Interpreter

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:

Visual Studio 2019: Xamarin.iOS Installer Visual Studio for Mac 8.0: Xamarin.iOS Installer

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

Adding --interpreter to the Additional mtouch arguments.

We have some small samples available which show off some of the new functionality.

Known Issues

Try It Out!

Please take the new interpreter for a spin and provide feedback here: https://github.com/xamarin/xamarin-macios/issues/new