doc/articles/features/using-skia-rendering.md
Available on iOS, Android, macOS, Windows, Linux and WebAssembly, based on the Skia drawing library, the Skia Renderer is a cross-platform unified rendering component of Uno Platform which provides a single UI experience across all supported platforms.
The whole UI Visual Tree is drawn on an hardware accelerated canvas, using Metal, OpenGL, Vulkan, and WebGL where applicable. Unlike Native rendering, Skia doesn’t rely on platform UI components.
The Skia Rendering backend has a very cheap cost for creating UI elements, which makes it very efficient for large user interfaces.
Starting with Uno.Sdk 6.0, it is the default rendering engine when creating a project from the templates. On WebAssembly (Wasm), Android, and iOS, you can opt in to use the native rendering engine instead.
This renderer supports integrating native views.
[!NOTE] The WinAppSDK target is not provided by Uno Platform directly, so it only offers the native rendering mode.
As the Skia Renderer bypasses native UI components, Skia can offer pixel-perfect rendering and visual consistency. The same UI is offered by default, but platform-specific theming is possible using Uno.Themes.
[!TIP] If you are building a custom drawing application, charts, or games in Uno Platform, Skia can offer more flexibility and uniform visuals across platforms.
You can use our Visual Studio Wizard to create a new project. By default, the Wizard uses the Skia rendering engine, automatically setting up the necessary MSBuild properties and references for you. If you prefer to use native rendering instead, you can select it in the Wizard’s configuration options. You can find more details on how to use the Wizard here: Creating a new project.
[!NOTE] If you're upgrading an existing project to Uno Platform 6.0, be sure to also check our migration guidance in Migrating from previous releases.
To enable Skia rendering in your Uno Platform project, you must opt in using MSBuild properties and features.
On macOS, Linux, and Windows, using the netX.0-desktop target framework, Skia rendering is always used.
However, when using WinAppSDK, the native rendering engine is always used, regardless of whether Skia or Native is enabled in UnoFeatures.
[!NOTE] Starting with Uno Platform 6.0, Mac Catalyst is no longer present in templates, and we encourage users to move to
netX.0-desktop, which runs on macOS using Skia for rendering.
You can find more details in Using the Skia Desktop.
[!TIP] If your project was created before Uno Platform 6.0 and you want to enable Skia rendering, follow the upgrade guide.
Using Skia rendering might have some limitations compared to native rendering. Some of the known limitations include:
SkiaRenderer from UnoFeatures inside the project's .csproj file to target native rendering, then setting it back after a new build will raise a runtime Exception. You will need to remove bin and obj folders, and clear site data of the browser app in order to avoid encountering this exception.Skia rendering is best suited for cross-platform scenarios where a unified appearance and customized graphics are key. Some native integration scenarios may not yet be supported. If you encounter any of such scenarios, make sure to let it be known by opening an issue.
In order to accommodate the inclusion of Skia rendering for all platforms, the Uno Platform internal structure uses two layers of "bait-and-switch" of reference assemblies.
When building in the SkiaRenderer node, an application compiles against "reference" versions of Uno.UI, Uno.UI.Dispatching, Uno.UI.Composition, Uno, and Uno.Foundation. When the application is being packaged, Uno.UI and Uno.UI.Composition are switched to the Skia-compatible versions. The Uno.UI.Dispatching, Uno, and Uno.Foundation are switched to their corresponding target platform versions.
By doing so, any use of the APIs provided by Uno.UI.Dispatching, Uno, and Uno.Foundation is automatically redirected to the proper platform support, for instance, redirecting GeoLocator to use the proper APIs provided by the underlying platform.
At this time, NuGet packages that provide UI features on iOS/Android may not be consumed by both native and Skia renderer projects under certain conditions.
The reason for this limitation is caused by the fact that Native renderers expose a different API set for Microsoft.UI.Xaml types, therefore causing incompatibility issues when apps use such a library.
Here are the different scenarios:
Given a library that uses net10.0-ios or net10.0-android, which does not have the SkiaRenderer set as an UnoFeature, but uses platform conditional code with #if blocks:
net10.0 TFM. In this case, for a native app, nothing changes.SkiaRenderer enabled app, the net10.0 variant of the library will be used and will not offer iOS/Android specific conditional code, but any code that uses Uno Platform provided APIs will work properly.Given a library that uses net10.0-ios or net10.0-android, which does have the SkiaRenderer set as an UnoFeature, but uses platform conditional code with #if blocks: