Latest 3.0
Homepage https://github.com/RxSwiftCommunity/RxEventHub
License MIT
Platforms ios 8.0
Dependencies RxSwift
Authors

CI Status
Version
License
Platform

Overview

RxEventHub is an event hub in RxSwift world, it makes multicasting event easy, type-safe and error-free, it’s intent to replace usage of NSNotificationCenter in most cases.

To make multicasting event type-safe and error-free, this lib provides RxEventProvider with generic type. For each type of event you want to send and observe, you create a subclass of RxEventProvider, just like below:

class ExampleIntEventProvider: RxEventProvider<Int>{}

This class is used to provide type info and event name. You may override the typeKey method to provide custom event name.

You can notify the hub when events occur by simply writing 1 line code like below:

RxEventHub.sharedHub.notify(ExampleIntEventProvider(), data: 2)

You can get the Observable (Observable<Int> in this example) when events occur by simply writing 1 line code like below:

RxEventHub.sharedHub.eventObservable(ExampleIntEventProvider())

One more thing, you can either use the default hub RxEventHub.sharedHub, or create different hubs for different modules as you want.

Requirements

  • Swift 3 (use 0.1.1 version for Swift 2)

Installation

CocoaPods

RxEventHub is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "RxEventHub"

Manual

Just copy RxEventHub.swift into your project, and you’re ready to go.

License

RxEventHub is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RxEventHub",
    "version": "3.0",
    "summary": "`RxEventHub` makes multicasting event easy, type-safe and error-free, use it instead of `NSNotificationCenter` now!",
    "description": "`RxEventHub` is an event hub in `RxSwift` world, it makes multicasting event easy, type-safe and error-free, use it instead of `NSNotificationCenter` now!",
    "homepage": "https://github.com/RxSwiftCommunity/RxEventHub",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "zzdjk6": "[email protected]"
    },
    "source": {
        "git": "https://github.com/RxSwiftCommunity/RxEventHub.git",
        "tag": "3.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "RxEventHub/Classes/**/*",
    "dependencies": {
        "RxSwift": [
            "~> 3.0"
        ]
    }
}

Pin It on Pinterest

Share This