user3255746 user3255746 - 1 month ago 28
Swift Question

Swift 3 Dispatch Queue conversion

I am new to Swift and am having difficulty converting all of my code to the Swift 3. Specifically, my problem is with the Dispatch Queue. Here is my code:

dispatch_group_notify(workGroup, DispatchQueue.main){
self.descs = [self.query1desc, self.query2desc]
self.carouselView.reloadData()
}


Does anyone know what changes I need to make to have it compatible with Swift 3?

Answer

Try this instead:

workGroup.notify(queue: DispatchQueue.main, execute: {
    self.descs = [self.query1desc, self.query2desc]
    self.carouselView.reloadData()
})
Comments