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

MasterViewController

We will present a list of items to the user in MasterViewController:

import UIKit class MasterViewController: UITableViewController {     @IBOutlet weak var filterSegmentedControl: UISegmentedControl!     var viewModel = TodosViewModel(todos: []) {         didSet {             tableView.reloadData()         }     }     override func viewDidLoad() {         super.viewDidLoad()         listTodos {             (response, error) in             if error == nil {                 store.dispatch(LoadTodosAction(todos: response!))             } else {                 print("Error: \(error?.localizedDescription)")             }         }         filterSegmentedControl.addTarget(self, action:            #selector(MasterViewController.filterValueChanged), for:            .valueChanged)         store.activeFilter.producer.startWithValues {             filter in  self.filterSegmentedControl.selectedSegmentIndex ...

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