Join Scott Gardner for an in-depth discussion in this video Bind UI elements: Part 2, part of Reactive Programming in iOS with RxSwift.
- [Voiceover] Continuing on in the same project…from the last video, I'll pick up where I left off…and show an example of binding a UI segmented control.…UI segmented control instances have an rx_value…control property that creates an observable sequence…of the currently selected segment.…Let's say I didn't want to initially print anything…to the corresponding label because the segmented control…starts out with nothing selected.…Well, I can use the skip operator…to skip the specified number of emissions.…And then I'll set the segmented control label.text…to a new concatenated string,…including the selected segment.…
And I'll once again use an animation block…to make the label display animate smoothly.…In this next example, just as a variation…from binding to labels, I'll bind to the relative position…of a UI slider to a UI progressView.…UI sliders also have an rx_value control property,…and because I've made the slider value range…from zero to one,…I can simply bind that value to the progressView,…which also expects a value from zero to one.…
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