Re: performSelector in Swift
Re: performSelector in Swift
- Subject: Re: performSelector in Swift
- From: Roland King <email@hidden>
- Date: Fri, 11 Jul 2014 12:39:14 +0800
> On 11 Jul 2014, at 11:48 am, Gerriet M. Denkmann <email@hidden> wrote:
>
> Swift has this method:
> +cancelPreviousPerformRequestsWithTarget:selector:object:
> which "Cancels perform requests previously registered with performSelector:withObject:afterDelay:."
>
> But performSelector:withObject:afterDelay: seems NOT to exist in Swift (no Swift code in documentation).
>
> The Swift with Obj-C book says: “The performSelector: method and related selector-invoking methods are not imported in Swift because they are inherently unsafe.”
>
> So: what is the point of cancelPreviousPerformRequestsWithTarget in Swift?
Probably an oversight, file a bug on it.
>
> What to do when porting code which uses performSelector?
>
> 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?
>
People still use that to hop event loops? You’ll be telling me there are still coders doing manual retain release next. :)
dispatch_* has been the API for async perform and delays for a while now. It’s queue-based and not runloop based, but rarely is that a problem.
_______________________________________________
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