Join Scott Gardner for an in-depth discussion in this video Error handling: Part 1, part of Reactive Programming in iOS with RxSwift.
- Many observables can emit error events.…And there are operators available to preemptively catch…and handle or retry.…Also drivers which guarantee not terminate with…an error event, can determine what to return in the event…an error does occur, ahead of time.…Because I'll be showing an example of using driver, I've…also imported RxCocoa and I've added an error type…to support code file for this playground.…In the main playground file, I'll start out with the…"catch error just return" operator.…
Catch error just return recovers from an error event by…returning an observable sequence that emits a single…element and then terminates.…To demonstrate, I'll create a sequence that I'm going…to make emit an error.…And use the operator on it so simply return…a smiley face emoji.…You can use the keyboard shortcut…command + control + space bar to pull up the…emoji and symbols menu or select…edit emoji and symbols from the menu.…And I'll subscribe and print out emitted events.…
Okay so first I'll add a value on to that sequence…
Learn reactive programming with Reactive Extensions for Swift and iOS by following along with author Scott Gardner. Scott introduces the Reactive Extensions libraries for Swift and Cocoa Touch, and shows how to work with observable sequences, bind user interface and data elements, perform networking operations, debug Rx code, and more.
- Using the Reactive Extensions library
- Working with observable sequences
- Binding UI and data elements
- Binding table and collection views
- Error handling