fabian fabian - 1 year ago 84
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(), ^{

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download