Skip to content
Anthony edited this page Jul 16, 2019 · 2 revisions

This article details the steps needed to get an Ultraviolet project working on the iOS platform.

The Basics

Because Ultraviolet is a .NET project, you will need to install the Xamarin framework in order to build and deploy Ultraviolet-based applications which target iOS.

Ultraviolet provides iOS-targeted copies of all of its core libraries as part of their standard NuGet packages. In addition to the core libraries, the Ultraviolet.Shims.iOS.dll compatibility shim must also be included as a reference in any project which targets iOS. This assembly is responsible for providing Ultraviolet with services that provide platform-specific functionality.

Your code should be mostly compatible between platforms. However, you should be aware of the way that the Xamarin linker works when deploying to iOS. Because iOS does not allow runtime code generation, your .NET code is compiled directly to native iOS code by Xamarin. As part of this process, code which Xamarin believes is unused will be removed entirely by the linker. This can be a problem if certain assemblies are only accessed via runtime reflection.

The UltravioletApplication class provides a method called EnsureAssemblyIsLinked<T> which is designed to help combat this problem. Calling this method, and using a type from a particular assembly as its generic parameter, will create a static reference between your application code and the assembly in question, which should prevent is from being removed by the linker.

Be aware that individual classes, properties, and methods within the assembly can still be removed by the linker! Consult Xamarin's documentation for more information on how this all works.

Content

Content assets should be added to the iOS project as bundle resources, which can be done by opening each asset file's properties panel in Visual Studio and setting the Build Action to BundleResource.

Clone this wiki locally