unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.06k stars 735 forks source link

Add an API to get the current Uno Platform target at runtime #11545

Open MartinZikmund opened 1 year ago

MartinZikmund commented 1 year ago

What would you like to be added:

Currently it is possible to conditionally compile code to run on specific platforms, but there is no easy way to check the current Uno target at runtime. This would be especially useful to differentiate between Skia targets.

This could be a simple static method that would return an enum with Windows, iOS, SkiaWpf, SkiaGtk, etc.

Why is this needed:

Runtime checks

For which Platform:

All

BernhardPollerspoeck commented 1 year ago

@MartinZikmund i hope you dont mind me highjacking your issue.
 

i am at the moment working out on where i could set the current value. Any guidance here is apprechiated. 

i plan this week to create a first draft PR for the extension of the PlatformHelper class and creation of the new enum.