Dans mon code simple, je veux interrompre le processus dans la file d'attente globale si la condition x == 2 et aller à la file d'attente principale.Comment break file file dans dispatch_async iOS Swift 2.0
Comment procéder pour cela?
Dario Basso Cardoso
var x = 1
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW,0)) {
x++
if x == 2 {
break // error in this part or
return // does not work well
}
// more codes...
dispatch_async(dispatch_get_main_queue()) { () -> Void in
// execute the main code
// with break or not
if x == 2 {
// verified that break
}
// next codes
}
}