fabian fabian - 3 months ago 21
Swift Question

What is the Swift equivalent for dispatch_group_create

How do I wait for several methods to be completed?

This is the objective-c solution:

self.dispatch_group = dispatch_group_create();
dispatch_group_notify(self.dispatch_group, dispatch_get_main_queue(), ^{


Swift is mostly compatible to Objective-C and I have no issues with this code:

let dispatch_group = dispatch_group_create()
dispatch_group_notify(dispatch_group, dispatch_get_main_queue()) { }

There's an Apple document about transferring your Objective-C code to Swift: https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/buildingcocoaapps/Migration.html