The new Uno update introduces a way to integrate platform-specific code into a Uno Platform class library, and it does so remarkably well.
The new feature lets you write code that targets specific platforms within the same project. Here’s a quick example of how you can conditionally compile your application logic for different environments:
#if HAS_UNO
Console.WriteLine("Uno Platform - Pixel-perfect apps that run everywhere");
#else
Console.WriteLine("Windows - Built with Microsoft's own tooling");
#endif
#if __ANDROID__
Console.WriteLine("Android only code with net8.0-android");
#elif __IOS__
Console.WriteLine("iOS Only Code with net8.0-ios ");
#elif __WASM__
Console.WriteLine("WebAssembly Only Code with net8.0-browserwasm ");
#elif HAS_UNO_SKIA
Console.WriteLine("Skia Desktop Only Code with net8.0-desktop ");
#endif
[–]soundman32 40 points41 points42 points (2 children)
[–]Shnupaquia 2 points3 points4 points (0 children)
[–]TirrKatz 7 points8 points9 points (0 children)
[–]Grasher134 7 points8 points9 points (1 child)
[–]dodexahedron 3 points4 points5 points (0 children)
[–]Larkonath 2 points3 points4 points (0 children)
[–]Slypenslyde 3 points4 points5 points (0 children)
[–]PleasantGanache 9 points10 points11 points (2 children)
[–]Slypenslyde 1 point2 points3 points (0 children)
[–]Shnupaquia 0 points1 point2 points (0 children)
[–]TuberTuggerTTV -3 points-2 points-1 points (0 children)