mirror of
https://github.com/ReactiveX/RxSwift.git
synced 2024-10-05 06:27:29 +03:00
Update tips to Swift 3 syntax
Update the syntax to RxSwift for Swift 3
This commit is contained in:
parent
4952adb27c
commit
81743e5b6c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user