response, error in if (error == nil) { let nextViewController = ... navigationController.pushViewController(nextViewController) } else { showErrorMessage(error) } } } 10 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015
know business logic details > View Controllers need to manage significant amount of state (almost anything that is not stored in the DB) 16 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015
know business logic details > View Controllers need to manage significant amount of state (almost anything that is not stored in the DB) > State management & propagation happens ad-hoc 17 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015
know business logic details > View Controllers need to manage significant amount of state (almost anything that is not stored in the DB) > State management & propagation happens ad-hoc > Very difficult to build a mental model of how an application works 18 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015
AppState { var state = state switch action.type { case CounterActionIncrease: state.counter += 1 case CounterActionDecrease: state.counter -= 1 default: break } return state } } 28 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015
self.apiClient.fetchUsers() { users in store.dispatch( SetUsers(users) ) } } } 35 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015
intent and implementation > Clear, Declarative API > Predictable, explicit state 41 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015
intent and implementation > Clear, Declarative API > Predictable, explicit state > Program has a shape 42 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015
intent and implementation > Clear, Declarative API > Predictable, explicit state > Program has a shape > Automatic state propagation 43 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015
> Dan Abramov (@dan_abramov) for building Redux > Jake Craige (@jakecraige) for feedback and support during implementation 44 — Unidirectional Data Flow in Swift | @benjaminencz | SLUG @ Realm, December 2015