To run the example project, clone the repo, and run pod install
from the Example directory first.
None
GBAsyncOperation is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'GBAsyncOperation'
import GBAsyncOperation
This is an example of a typical asynchronous operation subclass. For the proper operation lifecycle it is required to call finish()
method upon async code completion. This will signal the operation that it should be finished, otherwise it will be stuck in the queue.
class MyAsyncOperation: GBAsyncOperation {
// your properties
var completion: () -> Void
init(completion: @escaping () -> Void) {
self.completion = completion
}
override func main() {
// your async code here, which eventually calls completeOperation()
}
func completeOperation() {
guard !isCancelled else {
return
}
completion()
finish()
}
}
GBSerialGroupOperation class provides an ability of grouping asynchronous operations in a bundle and creating a dependency between them
Gennady Berezovsky
GBAsyncOperation is available under the MIT license. See the LICENSE file for more info.