Join Scott Gardner for an in-depth discussion in this video Bind data elements, part of Reactive Programming in iOS with RxSwift.
- View Offline
- [Voiceover] I'm starting out in a basic…single-view project with just a text field and a button,…and a tap gesture recognizer added to the storyboard scene.…These are also wired up as IB outlets…in the view controller.…I've also created a dispose bag instance…and used tap gesture recognizers, rx_event,…to dismiss the keyboard when a tap is recognized,…as I did in the Bind UI Elements example project.…So let's say that I want to bind the text…from the text field to a variable.…A variable might be a good choice here if, for example,…I want observers to that variable to receive…the latest value or the initial value.…
In this case, an empty string upon subscription.…So first I'll create a variable property…with an empty string as the initial value.…Now I'll bind the text fields, rx text control property…to the text field text variable.…You may be wondering why I didn't use Driver here.…I primarily use Driver one way: to drive UI elements.…So while I might use Driver to drive a label with…the next element emitted from a variable,…
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