Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Updating to 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Feb 10, 2019
1 parent 8e78a2c commit 82aabee
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion OperationPlus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'OperationPlus'
s.version = '1.1.0'
s.version = '1.2.0'
s.summary = 'NSOperation\'s missing pieces'

s.homepage = 'https://github.com/ChimeHQ/OperationPlus'
Expand Down
2 changes: 1 addition & 1 deletion OperationPlus/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<string>1.2.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
Expand Down
2 changes: 1 addition & 1 deletion OperationPlus/OperationPlus.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
PRODUCT_NAME = OperationPlus
PRODUCT_BUNDLE_IDENTIFIER = com.chimehq.OperationPlus
PRODUCT_MODULE_NAME = OperationPlus
CURRENT_PROJECT_VERSION = 3
CURRENT_PROJECT_VERSION = 4

INFOPLIST_FILE = OperationPlus/Info.plist

Expand Down
2 changes: 1 addition & 1 deletion OperationTestingPlus/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<string>1.2.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
Expand Down
2 changes: 1 addition & 1 deletion OperationTestingPlus/OperationTestingPlus.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SUPPORTED_PLATFORMS = macosx iphonesimulator iphoneos appletvos appletvsimulator
PRODUCT_NAME = OperationTestingPlus
PRODUCT_BUNDLE_IDENTIFIER = com.chimehq.OperationTestingPlus
PRODUCT_MODULE_NAME = OperationTestingPlus
CURRENT_PROJECT_VERSION = 3
CURRENT_PROJECT_VERSION = 4

INFOPLIST_FILE = OperationTestingPlus/Info.plist

Expand Down
41 changes: 36 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ pod 'OperationPlus'

## NSOperation Subclasses

- BaseOperation: provides core functionality for easier NSOperation subclassing
- AsyncOperation: convenience wrapper around BaseOperation for async support
- AsyncBlockOperation: convenience class for inline async support
- (Async)ProducerOperation: produces an output
- (Async)ConsumerOperation: accepts an input from a ProducerOperation
- (Async)ConsumerProducerOperation: accepst an input from a ProducerOperation and also produces an output

**BaseOperation**

This is a simple `NSOperation` subclass built for easier extensibility. It features:
Expand Down Expand Up @@ -92,15 +99,15 @@ class MyAsyncOperation: BaseOperation {
}
```

**ResultOperation**
**ProducerOperation**

A `BaseOperation` subclass that yields a value. Includes a completion handler to access the value.

```swift
import Foundation
import OperationPlus

class MyValueOperation: ResultOperation<Int> {
class MyValueOperation: ProducerOperation<Int> {
public override func main() {
// do your computation

Expand All @@ -117,15 +124,15 @@ op.resultCompletionBlock = { (value) in
}
```

**AsyncResultOperation**
**AsyncProducerOperation**

A variant of `ResultOperation` that may produce a value after the `main` method has completed executing.
A variant of `ProducerOperation` that may produce a value after the `main` method has completed executing.

```swift
import Foundation
import OperationPlus

class MyAsyncOperation: AsyncResultOperation<Int> {
class MyAsyncOperation: AsyncProducerOperation<Int> {
public override func main() {
DispatchQueue.global().async {
if self.checkForCancellation() {
Expand All @@ -140,6 +147,30 @@ class MyAsyncOperation: AsyncResultOperation<Int> {
}
```

**ConsumerOperation** and **AsyncConsumerOperation**

A `BaseOperation` sublass that accepts the input of a `ProducerOperation`.

```swift
import Foundation
import OperationPlus

class MyConsumerOperation: ConsumerOperation<Int> {
override func main() {
guard let value = producerValue else {
// handle failure in some way
}
}

override func main(with value: Int) {
// make use of value here, or automatically
// fail if it wasn't succesfully produced
}
}

let op = MyConsumerOperation(producerOp: myIntProducerOperation)
```

**AsyncBlockOperation**

A play on `NSBlockOperation`, but makes it possible to support asynchronous completion without making an `Operation` subclass. Great for quick, inline work.
Expand Down

0 comments on commit 82aabee

Please sign in to comment.