Re: Xcode-users Digest, Vol 11, Issue 223
Re: Xcode-users Digest, Vol 11, Issue 223
- Subject: Re: Xcode-users Digest, Vol 11, Issue 223
- From: Rainer Brockerhoff <email@hidden>
- Date: Fri, 11 Jul 2014 17:04:26 -0300
On 7/11/14, 16:00, email@hidden wrote:
Date: Thu, 10 Jul 2014 21:28:14 -0700
From: Jens Alfke <email@hidden>
To: "Gerriet M. Denkmann" <email@hidden>
Cc: email@hidden
Subject: Re: performSelector in Swift
On Jul 10, 2014, at 8:48 PM, Gerriet M. Denkmann <email@hidden> wrote:
There are several places where one needs to use
performSelector:withObject:afterDelay:0 to execute something as
soon as possible, but NOT in this event loop. How to do this in
Swift?
dispatch_async will do it … although it requires that you know which
dispatch queue to run it in; there’s no way to say “the current
queue” the way that a delayed-perform implicitly runs on the current
runloop.
I've done some testing on this and here's what I use now (at
https://github.com/rbrockerhoff/SwiftChecker/blob/master/SwiftChecker/Future.swift):
func PerformOnMain(work: () -> Void) {
CFRunLoopPerformBlock(NSRunLoop.mainRunLoop().getCFRunLoop(),
kCFRunLoopCommonModes, work)
}
(assumes Xcode 6.0b3)
HTH,
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
In their own business even sages err."
http://brockerhoff.net/blog/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden