Skip to content

Commit 97f0555

Browse files
committed
update 2.x with new README
1 parent 2a6561c commit 97f0555

File tree

1 file changed

+69
-21
lines changed

1 file changed

+69
-21
lines changed

README.md

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
1-
# Kotlin Adaptor for RxJava
1+
# RxKotlin
2+
3+
## Kotlin Extensions for RxJava
4+
5+
RxKotlin is a lightweight library that adds convenient extension functions to [RxJava](https://github.com/ReactiveX/RxJava). You can use RxJava with Kotlin out-of-the-box, but Kotlin has language features (such as [extension functions](https://kotlinlang.org/docs/reference/extensions.html)) that can streamline usage of RxJava even more. RxKotlin aims to conservatively collect these conveniences in one centralized library.
26

3-
This adaptor exposes a set of Extension functions that allow a more idiomatic Kotlin usage
47

58
```kotlin
6-
observable<String> { subscriber ->
7-
subscriber.onNext("H")
8-
subscriber.onNext("e")
9-
subscriber.onNext("l")
10-
subscriber.onNext("")
11-
subscriber.onNext("l")
12-
subscriber.onNext("o")
13-
subscriber.onCompleted()
14-
}.filter { it.isNotEmpty() }
15-
.fold (StringBuilder()) { sb, e -> sb.append(e) }
16-
.map { it.toString() }
17-
.subscribe { a.received(it) }
18-
19-
verify(a, times(1)).received("Hello")
9+
package rx.lang.kotlin
10+
11+
import rx.Observable
12+
13+
fun main(args: Array<String>) {
14+
15+
val list = listOf("Alpha", "Beta", "Gamma", "Delta", "Epsilon")
16+
17+
list.toObservable() // extension function for Iterables
18+
.filter { it.length >= 5 }
19+
.subscribeBy( // named arguments for lambda Subscribers
20+
onNext = { println(it) },
21+
onError = { it.printStackTrace() },
22+
onCompleted = { println("Done!") }
23+
)
24+
25+
}
2026
```
2127

2228
## Build
2329

2430
[![Build Status](https://travis-ci.org/ReactiveX/RxKotlin.svg?branch=0.x)](https://travis-ci.org/ReactiveX/RxKotlin)
2531

32+
2633
## Binaries
2734

35+
2836
Binaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Crxkotlin).
2937

3038
Example for Maven:
@@ -37,14 +45,54 @@ Example for Maven:
3745
</dependency>
3846
```
3947

40-
and for Ivy:
48+
and for Gradle:
4149

42-
```xml
43-
<dependency org="io.reactivex" name="rxkotlin" rev="x.y.z" />
50+
```groovy
51+
compile 'io.reactivex:rxkotlin:x.y.z'
4452
```
4553

46-
and for Gradle:
54+
You can also use Gradle or Maven with [JitPack](https://jitpack.io/) to build directly off a snapshot, branch, or commit of this repository.
55+
56+
For example, to build off the 1.x branch, use this setup for Gradle:
4757

4858
```groovy
49-
compile 'io.reactivex:rxkotlin:x.y.z'
59+
repositories {
60+
maven { url 'https://jitpack.io' }
61+
}
62+
63+
dependencies {
64+
compile 'com.github.ReactiveX:RxKotlin:1.x-SNAPSHOT'
65+
}
66+
```
67+
68+
Use this setup for Maven:
69+
70+
```xml
71+
<repositories>
72+
<repository>
73+
<id>jitpack.io</id>
74+
<url>https://jitpack.io</url>
75+
</repository>
76+
</repositories>
77+
78+
<dependency>
79+
<groupId>com.github.ReactiveX</groupId>
80+
<artifactId>RxKotlin</artifactId>
81+
<version>1.x-SNAPSHOT</version>
82+
</dependency>
5083
```
84+
85+
Learn more about building this project with JitPack [here](https://jitpack.io/#ReactiveX/RxKotlin).
86+
87+
## Kotlin Slack Channel
88+
89+
Join us on the #rx channel in Kotlin Slack!
90+
91+
https://kotlinlang.slack.com/messages/rx
92+
93+
## Contributing
94+
95+
We welcome contributions and discussion for new features. It is recommended to file an issue first to prevent unnecessary efforts, but feel free to put in pull requests. The vision is to keep this library lightweight, with a tight and focused scope applicable to all platforms (including Android, server, and desktop). Anything specific to a particular domain (for example, [JavaFX](https://github.com/thomasnield/RxKotlinFX), [Math](https://github.com/thomasnield/rxkotlin-math), or [JDBC](https://github.com/davidmoten/rxjava-jdbc)) might be better suited as a separate project. Feel free to open discussion and we will help figure out where your functionality may belong.
96+
97+
98+

0 commit comments

Comments
 (0)