Quantcast
Viewing all articles
Browse latest Browse all 204402

best way to Await PresentViewController ?

What is the best way to use the new Async/Await syntax with PresentViewController and DismissViewController?

I know you can pass a call completion handler, but I would rather use something like: await myViewController.PresentViewController(...)

This was my first pass and while it meets my goal of describing an asynchronous method in a single method body, it leaves a bit to be desired.

        var waiter = new ManualResetEvent(false);
        TopViewController.PresentViewController(viewController, animated, () => waiter.Set());
        await Task.Factory.StartNew(() =>
        {
            //wait until presented view controller
            waiter.WaitOne();
        });

What have people got that's better?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>