O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DetailsViewController

We will use DetailsViewController to present the details of a Todo item and modify it. We will have three textField and a switch. We will observe the changes in the UI and modify the State and backend. The code is as follows:

import UIKit import ReactiveCocoa import ReactiveSwift class DetailsViewController: UIViewController {     @IBOutlet weak var txtFieldName: UITextField!     @IBOutlet weak var txtFieldDescription: UITextField!     @IBOutlet weak var txtFieldNotes: UITextField!     @IBOutlet weak var switchCompleted: UISwitch!     var viewModel = TodoViewModel(todo: nil)     override func viewDidLoad() {         super.viewDidLoad()         store.selectedTodo.startWithValues {             todos in             let model = todos.first!  self.txtFieldName.text = model.name ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required