samedi 18 octobre 2014

Figuring out syntax for Grand Central Dispatch in Swift


Vote count:

0




I have the following code:



dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {

// Do stuff in the backgroud

dispatch_async(dispatch_get_main_queue()) {

// Do stuff on the UI thread

}
}


However it will not compile. The inner call to dispatch_async returns the following compile error:



Cannot invoke 'init' with an argument list of type '(dispatch_queue_t!, () -> () -> $T3)'


I can't seem to figure out how to write this so that it works like I used to be able to in Objective C. Thanks for any ideas!



asked 38 secs ago







Figuring out syntax for Grand Central Dispatch in Swift

Aucun commentaire:

Enregistrer un commentaire