Latest 0.1.3
Homepage https://github.com/wassimseif/rxrelay
License MIT
Platforms ios 9.0
Dependencies RxSwift
Authors

This is my attempt to create an RxRelay implementation in RxSwift.

Why

Because the Observer Design pattern is something every developer should know. It facilitates the communication between objects and simplify the logic of your app. Implementing it in a Reactive way will take it to a whole new level.

Installation

Currently the recommended installation method is Cocoapods

  • In your Podfile

    • Add this pod 'RxRelay'

      Usage

    • BehaviorRelay

    Relay that emits the most recent item it has observed and all subsequent observed items to each
    subscribed Observer.

    • PublishRelay

    Relay that, once an Observer has subscribed, emits all subsequently observed items to the
    subscriber.

    var relay = PublishRelay<String>()
    
        let subscription = relay.subsribe { (string ) in
            print("I have Received :(string)")
        }
    
        relay.accept("Hello")
        relay.accept("World")
        subscription.dispose()
        relay.accept("Will not be emitted ")
    • ReplayRelay

    Relay that buffers all items it observes and replays them to any Observer that subscribes.

    let relay = ReplayRelay<String>(withBufferSize: 2)
    relay.accept("1")
    relay.accept("2")
    relay.accept("3")
    let subscription = relay.subsribe { (string) in
        print("I have received : (string)")
    }
    // subscription will get 2 , 3 , 4
    relay.accept("4")

Latest podspec

{
    "name": "RxRelay",
    "version": "0.1.3",
    "summary": "Reactive broadcaster pattern",
    "description": "Because the Observer Design pattern is something every developer should know. It facilitates the communication between objects and simplify the logic of your app. Implementing it in a Reactive way will take it to a whole new level.",
    "homepage": "https://github.com/wassimseif/rxrelay",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Wassim  Seifeddine": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/wassimseif/RxRelay.git",
        "tag": "0.1.3"
    },
    "source_files": [
        "RxRelay",
        "*"
    ],
    "exclude_files": "",
    "dependencies": {
        "RxSwift": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This