In cases where you are dealing with events (OnAppear essentiallt the callback for Appear) it's totally fine.
Return Types An async method should return a Task, Task or
void.
Specify the Task return type if the method does not return any other
value.
Specify Task if the method needs to return a value, where
TResult is the type being returned (such as an int, for example).
The void return type is used mainly for event handlers which require
it. Code that calls void-returning asynchronous methods can’t await on
the result.
In short use task when possible but in cases related to event handlers just use void.
If you were needing to call async otherwise then you could use a TaskCompletionSource
as per this question
Is it possible to await an event instead of another async method?
private TaskCompletionSource<object> continueClicked;
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
// Note: You probably want to disable this button while "in progress" so the
// user can't click it twice.
await GetResults();
// And re-enable the button here, possibly in a finally block.
}
private async Task GetResults()
{
// Do lot of complex stuff that takes a long time
// (e.g. contact some web services)
// Wait for the user to click Continue.
continueClicked = new TaskCompletionSource<object>();
buttonContinue.Visibility = Visibility.Visible;
await continueClicked.Task;
buttonContinue.Visibility = Visibility.Collapsed;
// More work...
}
private void buttonContinue_Click(object sender, RoutedEventArgs e)
{
if (continueClicked != null)
continueClicked.TrySetResult(null);
}
References
https://developer.xamarin.com/guides/cross-platform/advanced/async_support_overview/
https://msdn.microsoft.com/en-us/magazine/jj991977.aspx
https://developer.xamarin.com/guides/ios/user_interface/controls/part_2_-_working_with_the_ui_thread/