Update tips to Swift 3 syntax

Update the syntax to RxSwift for Swift 3
This commit is contained in:
Victor Sigler 2016-12-08 21:37:08 -05:00 committed by GitHub
parent 4952adb27c
commit 81743e5b6c

View File

@ -26,19 +26,19 @@ extension ObservableType where E: MaybeCool {
**Avoid nesting subscribe calls at all cost. This is a code smell.**
```swift
textField.rx_text.subscribeNext { text in
performURLRequest(text).subscribeNext { result in
textField.rx.text.subscribe(onNext: { text in
performURLRequest(text).subscribe(onNext: { result in
...
}
})
.addDisposableTo(disposeBag)
}
})
.addDisposableTo(disposeBag)
```
**Preferred way of chaining disposables by using operators.**
```swift
textField.rx_text
textField.rx.text
.flatMapLatest { text in
// Assuming this doesn't fail and returns result on main scheduler,
// otherwise `catchError` and `observeOn(MainScheduler.instance)` can be used to