AsyncBlockOperation 1.0.1

AsyncBlockOperation 1.0.1

DocsDocumented
TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2015

Maintained by Suyeol Jeon.


Downloads

Total14,722
Week285
Month1,086

Installs

Apps90
Apps WeekApps This Week 29
Test Targets21
Test WeekTests This week 6
powered by Segment

GitHub

Stars12
Watchers0
Forks1
Issues0
Contributors1
Pull Requests0

Code

Files2
SizeIntegration Size 16 kb
FrameworkCreates Framework
LOCLines of Code 56


  • By
  • devxoul

NSOperation subclass for support async block.

At a Glance

Swift

import AsyncBlockOperation

let queue = NSOperationQueue()

/// Method 1. Using `AsyncBlockOperation` object
let operation = AsyncBlockOperation { op in
    op.complete() // call this method when async task finished
}
queue.addOperation(operation)

/// Method 2. Using `NSOperationQueue` method
queue.addOperationWithAsyncBlock { op in
    op.complete()
}

Objective-C

#import <AsyncBlockOperation/AsyncBlockOperation.h>

NSOperationQueue *queue = [[NSOperationQueue alloc] init];

// Method 1. Using `AsyncBlockOperation` object
AsyncBlockOperation *operation = [AsyncBlockOperation blockOperationWithBlock:^(AsyncBlockOperation *op) {
    [op complete]; // call this method when async task finished
}];
[queue addOperation:operation];

// Method 2. Using `NSOperationQueue` method
[queue addOperationWithAsyncBlock:^(AsyncBlockOperation *op) {
    [op complete];
}];

Installation

I recommend you to use CocoaPods, a dependency manager for Cocoa.

Podfile

pod 'AsyncBlockOperation', '~> 1.0'

License

AsyncBlockOperation is under MIT license. See the LICENSE file for more info.