Skip to content

Commit 45a64a5

Browse files
committed
Update Readme
1 parent 2e17dff commit 45a64a5

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

README.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,55 @@
11
# RxEventHub
22

3-
[![CI Status](http://img.shields.io/travis/Chen Shenghan/RxEventHub.svg?style=flat)](https://travis-ci.org/Chen Shenghan/RxEventHub)
3+
[![CI Status](http://img.shields.io/travis/zzdjk6/RxEventHub.svg?style=flat)](https://travis-ci.org/zzdjk6/RxEventHub)
44
[![Version](https://img.shields.io/cocoapods/v/RxEventHub.svg?style=flat)](http://cocoapods.org/pods/RxEventHub)
55
[![License](https://img.shields.io/cocoapods/l/RxEventHub.svg?style=flat)](http://cocoapods.org/pods/RxEventHub)
66
[![Platform](https://img.shields.io/cocoapods/p/RxEventHub.svg?style=flat)](http://cocoapods.org/pods/RxEventHub)
77

8-
## Example
8+
## Overview
99

10-
To run the example project, clone the repo, and run `pod install` from the Example directory first.
10+
`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.
11+
12+
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:
13+
14+
```swift
15+
class ExampleIntEventProvider: RxEventProvider<Int>{}
16+
```
17+
18+
This class is used to provide type info and event name. You may override the `typeKey` method to provide custom event name.
19+
20+
You can notify the hub when events occur by simply writing 1 line code like below:
21+
22+
```swift
23+
RxEventHub.sharedHub.notify(ExampleIntEventProvider(), data: 2)
24+
```
25+
26+
You can get the `Observable` when events occur by simply writing 1 line code like below:
27+
28+
```swift
29+
RxEventHub.sharedHub.eventObservable(ExampleIntEventProvider())
30+
```
31+
32+
One more thing, you can either use the default hub `RxEventHub.sharedHub`, or create different hubs for different modules as you want.
1133

1234
## Requirements
1335

36+
* Swift 2.x (use another branch for Swift 3, work in progress)
37+
1438
## Installation
1539

40+
### CocoaPods
41+
1642
RxEventHub is available through [CocoaPods](http://cocoapods.org). To install
1743
it, simply add the following line to your Podfile:
1844

1945
```ruby
2046
pod "RxEventHub"
2147
```
2248

49+
### Manual
50+
51+
Just copy `RxEventHub.swift` into your project, and you're ready to go.
52+
2353
## Author
2454

2555
Chen Shenghan, [email protected]

0 commit comments

Comments
 (0)