Latest 0.0.1
License MIT
Platforms tvos 9.0, ios 8.0, osx 10.10, watchos 2.0, requires ARC
Dependencies SReactiveFoundation



Carthage compatible
Build Status
GitHub release




You can install ReactiveCommander using CocoaPods adding the following lines to your Podfile:

pod "RXCommander" // For RxSwift
pod "RACCommander" // For ReactiveCocoa

Wherever you want to use the framework import it with import ReactiveCommander


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.

Minimum Version supported

  • tvOS – 9.0
  • iOS – 8.0
  • OSX – 10.10
  • watchOS – 2.1


  • Git clone the repository: git clone
  • Install Carthage: brew install carthage
  • Update Carthage dependencies: carthage update
  • Open the project 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.


  • Command: Default generic command where T is the returned type. This command has to be overriden before being used implementing the 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.
  • ReactiveCommander provides a custom operator to be used with 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.

Latest podspec

    "name": "SReactiveCommander",
    "version": "0.0.1",
    "summary": "Command Pattern foundation components based on Reactive",
    "description": "Command Pattern foundation components based on Reactive",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "@pepibumur": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.0.1"
    "platforms": {
        "tvos": "9.0",
        "ios": "8.0",
        "osx": "10.10",
        "watchos": "2.0"
    "requires_arc": true,
    "source_files": "ReactiveCommander/Source/**/*",
    "dependencies": {
        "SReactiveFoundation": [
            "~> 0.0"

Pin It on Pinterest

Share This