xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.52k stars 505 forks source link

[Enhancement] Add isiOSAppOnMac property #1700

Open VasenevEA opened 3 years ago

VasenevEA commented 3 years ago

Summary

With the release of computers on Apple Silicone, we got another platform on which the Xamarin application can run. We need a simple way to find out which device we are running on: iOS device or iOS on Mac

API Changes

add to DevicePlatform:

public static DevicePlatform iOSOnMac { get; } = new DevicePlatform(nameof(iOSOnMac));

Intended Use Case


if (DeviceInfo.Platform == DevicePlatform.iOSOnMac)
{
  //specific code
}
jamesmontemagno commented 3 years ago

Is available => https://stackoverflow.com/questions/65042788/how-to-detect-if-an-ios-app-is-running-on-an-m1-mac

I don't think it should be the device platform though to be honest with you as it would break a bunch of logic trees.

jamesmontemagno commented 3 years ago

I think we want to return "Desktop" for DeviceType in this case.

So you could do:

If(DeviceInfo.Platform == DevicePlatform.iOS && DeviceInfo.DeviceType == DeviceType.Desktop) { }

jamesmontemagno commented 3 years ago

Also need to coordinate with XF team

VasenevEA commented 3 years ago

I think we want to return "Desktop" for DeviceType in this case.

So you could do:

If(DeviceInfo.Platform == DevicePlatform.iOS && DeviceInfo.DeviceType == DeviceType.Desktop) { }

It will be great!