summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.MacOS/Extensions/NSViewControllerExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.MacOS/Extensions/NSViewControllerExtensions.cs')
-rw-r--r--Xamarin.Forms.Platform.MacOS/Extensions/NSViewControllerExtensions.cs24
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 0000000..f556232
--- /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