{"id":43683,"date":"2019-03-26T12:41:43","date_gmt":"2019-03-26T19:41:43","guid":{"rendered":"https:\/\/blog.xamarin.com\/?p=39364"},"modified":"2019-08-30T08:34:36","modified_gmt":"2019-08-30T15:34:36","slug":"introducing-xamarin-ios-interpreter","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/introducing-xamarin-ios-interpreter\/","title":{"rendered":"Introducing the Xamarin.iOS Interpreter"},"content":{"rendered":"<p>\t\t\t\tHistorically 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 \u201cAhead of Time\u201d (AOT) before deployment because of this. You can read more about this architecture <a href=\"https:\/\/docs.microsoft.com\/en-us\/xamarin\/ios\/internals\/architecture\">here<\/a>.<\/p>\n<h2>&#8220;Ahead of Time&#8221; AOT<\/h2>\n<p>In most cases, AOT can provide performance benefits. It can also restrict a number of C# features from being used:<\/p>\n<ul>\n<li><code>Assembly.Load<\/code> and <code>System.Reflection.Emit<\/code><\/li>\n<li>Some uses of the C# <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/programming-guide\/types\/using-type-dynamic\">dynamic feature<\/a><\/li>\n<\/ul>\n<p>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.<\/p>\n<h2>The Interpreter<\/h2>\n<p>Today we are promoting this experimental work into a preview ready for general testing.<\/p>\n<p>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.\u00a0 Get started previewing by installing the packages below:<\/p>\n<p>Visual Studio 2019: <a href=\"https:\/\/dl.xamarin.com\/uploads\/vnce31f5jqu\/Xamarin.VisualStudio.Alpha.16.1.0.2505763-775a48f.vsix\" target=\"_blank\" rel=\"noopener noreferrer\">Xamarin.iOS Installer<\/a>\nVisual Studio for Mac 8.0: <a href=\"https:\/\/dl.xamarin.com\/uploads\/ixgbtjcybks\/xamarin.ios-12.7.1.74.pkg\" target=\"_blank\" rel=\"noopener noreferrer\">Xamarin.iOS Installer<\/a><\/p>\n<p>Once you have the preview installed (don&#8217;t forget your Mac build host), you can enable the interpreter by:<\/p>\n<ul>\n<li>Opening the project\u2019s options<\/li>\n<li>Switch to <strong>iOS Build<\/strong><\/li>\n<li>Adding <code>--interpreter<\/code> to the <strong>Additional mtouch arguments.<\/strong><\/li>\n<\/ul>\n<p>We have some <a href=\"https:\/\/github.com\/spouliot\/interpreter\">small samples available<\/a> which show off some of the new functionality.<\/p>\n<h3>Known Issues<\/h3>\n<ul>\n<li>[mono] <a href=\"https:\/\/github.com\/mono\/mono\/issues\/9871\" target=\"_blank\" rel=\"noopener noreferrer\">No 32bits support<\/a> (impact iOS and watchOS)<\/li>\n<li>[mono] <a href=\"https:\/\/github.com\/mono\/mono\/issues\/11942\" target=\"_blank\" rel=\"noopener noreferrer\">No IL is stripped when the interpreter is enabled (even for AOT\u2019ed code)<\/a> which makes applications larger than they need to be<\/li>\n<\/ul>\n<h2>Try It Out!<\/h2>\n<p>Please take the new interpreter for a spin and provide feedback here: <a href=\"https:\/\/github.com\/xamarin\/xamarin-macios\/issues\/new\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/xamarin\/xamarin-macios\/issues\/new<\/a>\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 \u201cAhead of Time\u201d (AOT) before deployment because of this. You can read more about this architecture here.<\/p>\n","protected":false},"author":1329,"featured_media":39167,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,303],"tags":[6],"class_list":["post-43683","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developers","category-ios","tag-ios"],"acf":[],"blog_post_summary":"<p>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 \u201cAhead of Time\u201d (AOT) before deployment because of this. You can read more about this architecture here.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/43683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/users\/1329"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=43683"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/43683\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/39167"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=43683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=43683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=43683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}