File: Geolocation\GeolocationAccuracyExtensionMethods.ios.macos.cs
Web Access
Project: src\src\Essentials\src\Essentials.csproj (Microsoft.Maui.Essentials)
#nullable enable
using CoreLocation;
 
namespace Microsoft.Maui.Devices.Sensors
{
	static class GeolocationAccuracyExtensionMethods
	{
		internal static double PlatformDesiredAccuracy(this GeolocationAccuracy desiredAccuracy)
		{
			switch (desiredAccuracy)
			{
				case GeolocationAccuracy.Lowest:
					return CLLocation.AccuracyThreeKilometers;
				case GeolocationAccuracy.Low:
					return CLLocation.AccuracyKilometer;
				case GeolocationAccuracy.Default:
				case GeolocationAccuracy.Medium:
					return CLLocation.AccuracyHundredMeters;
				case GeolocationAccuracy.High:
					return CLLocation.AccuracyNearestTenMeters;
				case GeolocationAccuracy.Best:
					return CLLocation.AccurracyBestForNavigation;
				default:
					return CLLocation.AccuracyHundredMeters;
			}
		}
	}
}