This answer shows assigning a button TouchUpInside
event handler with the following syntax:
btnSave.TouchUpInside += async (sender, e) =>
{
await Createuser();
};
Is there an equivalent in F#? There does not seem to be a +=
overload in F#.
I have tried all of the following but the type system always yells at me that the result is not unit
btnSave.TouchUpInside.Add (fun s e -> async { return () })
btnSave.TouchUpInside.Add (fun s e -> async { return () } |> Async.StartAsTask )
The following compiles but throws an expected exception for any actions on the controller because we are no longer on the main UI Thread
btnSave.TouchUpInside.Add (fun s e -> async { return () } |> Async.Start)
I'd like to be able to run async functions with the F# equivalent of async/await
without having to constantly marshall back onto the main UI thread similar to the syntac sugar we get in C#