GitXplorerGitXplorer
w

RxRelay

public
6 stars
3 forks
0 issues

Commits

List of commits on branch master.
Unverified
cd33b8e03b9f72a28ca2c6dfb51fdadd3616abcf

Added installation documentation

wwassimseif committed 7 years ago
Unverified
1b5691fab5926f2c468fe9921c136ba44a9e2454

UPdated to 0.1.3

wwassimseif committed 7 years ago
Unverified
e9d1c5955527bc60db5e1cf1788cf962eee8bcb8

Wokring on Adding to Cocoapods Removed Pods from git

wwassimseif committed 7 years ago
Unverified
0bd70585c630c9dacf6feeec5fe4061fd3edffde

Migrated from carthage to manage depedencies to cocoapods

wwassimseif committed 7 years ago
Unverified
ce3150b545f08d7ccdcc11b0e9523689aefad974

Added Podspec

wwassimseif committed 8 years ago
Unverified
12621837071137e3123b3623d871841dd37de8bb

the minimum deployment target is now 9.0

wwassimseif committed 8 years ago

README

The README file for this repository.

RxRelay

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")