diff options
Diffstat (limited to 'Xamarin.Forms.Platform.MacOS/Extensions/NSViewControllerExtensions.cs')
-rw-r--r-- | Xamarin.Forms.Platform.MacOS/Extensions/NSViewControllerExtensions.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.MacOS/Extensions/NSViewControllerExtensions.cs b/Xamarin.Forms.Platform.MacOS/Extensions/NSViewControllerExtensions.cs new file mode 100644 index 00000000..f5562322 --- /dev/null +++ b/Xamarin.Forms.Platform.MacOS/Extensions/NSViewControllerExtensions.cs @@ -0,0 +1,24 @@ +using System; +using System.Threading.Tasks; +using AppKit; + +namespace Xamarin.Forms.Platform.MacOS +{ + internal static class NSViewControllerExtensions + { + public static Task<T> HandleAsyncAnimation<T>(this NSViewController container, NSViewController fromViewController, + NSViewController toViewController, NSViewControllerTransitionOptions transitonOption, + Action animationFinishedCallback, T result) + { + var tcs = new TaskCompletionSource<T>(); + + container.TransitionFromViewController(fromViewController, toViewController, transitonOption, () => + { + tcs.SetResult(result); + animationFinishedCallback?.Invoke(); + }); + + return tcs.Task; + } + } +}
\ No newline at end of file |