CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✓ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Jan 2016 |
| SPMSupports SPM | ✗ |
Maintained by Pedro Piñera.
CocoaPods
You can install ReactiveCommander using CocoaPods adding the following lines to your Podfile:
use_frameworks!
pod "RXCommander" // For RxSwift
pod "RACCommander" // For ReactiveCocoaWherever you want to use the framework import it with import ReactiveCommander
Carthage
It’s also available to install using Carthage
github "SwiftReactive/ReactiveCommander"Depending on the framework you want to use ReactiveCocoa or RxSwift you’ll have to add to your project, RACCommander or RXCommander respectively. Then import them with these names.
9.0 8.0 10.10 2.1 git clone https://github.com/swiftreactive/ReactiveCommander brew install carthage carthage update ReactiveCommander.xcodeproj ReactiveCommander implements the programming command pattern using NSOperationQueue and a Reactive approach. The idea of that pattern is encapsulating operations in command that are initialized with the required parameters to executed the action. These commands can be scheduled in a queue that will manage the threading, concurrency and execution of these commands.
public func action() throws -> T method.Commands can be enqueued in the CommandQueue which is a subclass of NSOperationQueue with a new method:
// ReactiveCocoa
func addCommand<T, E: ErrorType>(cmd: Command<T, E>) -> SignalProducer<T, E>
// RxSwift
public func addCommand<T>(cmd: Command<T>) -> Observable<T>When the SignalProducer is started or the Observable gets a subscriber, the command is added to the queue in order to be executed.
CommandQueue provides a singleton instance that can be accessed with CommandQueue.backgroundQueue. If you want to implement your own queue with your own NSOperationQueue configuration you can just subclass this class.Command and CommandQueues: let disposable = queue <~ command - Enqueues the command and return the disposable.Commands actions must be synchronous. The asynchrony is handled by the queue.Commands must represent isolated operations and complex relations between them should be avoided.ReactiveCommander is available under the MIT license. See the LICENSE file for more info.