namespace PureFSharpExample

open System
open System.Drawing

open Foundation
open UIKit
open Xamarin.Essentials

[<Register ("ViewController")>]
type ViewController (handle:IntPtr) =
    inherit UIViewController (handle)

    override x.ViewDidLoad () =
        base.ViewDidLoad ()
        

    override x.ViewDidAppear animated =
        base.ViewDidAppear animated
        async
            {
                let request = new GeolocationRequest(GeolocationAccuracy.High, TimeSpan.FromSeconds(3.0))

                try 
                    let! loc = Geolocation.GetLocationAsync(request) |> Async.AwaitTask
                    printfn "Location : Lat = %f Long = %f" loc.Latitude loc.Longitude
                with
                | _ as ex ->
                    printfn "Exception : %s" ex.Message

            }
            |> Async.RunSynchronously