Date post: | 21-Feb-2017 |
Category: |
Engineering |
Upload: | viktor-shcherban |
View: | 209 times |
Download: | 0 times |
1. Intro to Redux and unidirectional flow
2. Integrating Redux into the project
3. Conclusions and recommendations
4. Q&A
15 Feb 2017 Redux in iOS
Agenda
Model View Controller
15 Feb 2017 1. intro to Redux and unidirectional flow
Redux at a glance
15 Feb 2017 1. intro to Redux and unidirectional flow
15 Feb 2017 1. intro to Redux and unidirectional flow
Redux + details
Reducer
ACTION
STATE
PURE* FUNCTION
reducer
*No side effects, testable
15 Feb 2017
NEW STATE
1. intro to Redux and unidirectional flow
update UI by changing state object
UI = f(state)
Philosophy
Time Travel !
15 Feb 2017 1. intro to Redux and unidirectional flow
Code Demo
15 Feb 2017 2. integrating Redux (ReSwift)
https://github.com/ReSwift/ReSwiftReSwift by @benjaminencz
SubState
15 Feb 2017 2. integrating Redux (ReSwift)
subState1
Store
subState2
Reducer1
subState1
subState1
View1
View2
Observer
Reducer2
Model-View-Controller
Repository
Service
Provider
Singleton
DB
Network
15 Feb 2017 2. integrating Redux (ReSwift)
App Structure
View
Repository
Service
Provider
DB
NetworkRedux
15 Feb 2017 2. integrating Redux (ReSwift)
App Structure with Redux
• use ReSwift or your own implementation
• don’t keep everything in the AppState
15 Feb 2017 3. Conclusions
• unidirectional flow (readable)
• functional & reactive (testable)
• good separation of concern (maintainable)
• compatible with VIPER
15 Feb 2017 3. Conclusions
• ReSwift documentations isn’t that good
• App State is a God Object
When Redux works• App with lots of global state
• Apps with history of state (such as undo and redo actions)
• Apps with a number of async events.
• Apps where you need to save navigation state between sessions.
15 Feb 2017 3. Conclusions
Thank you!Viktor Shcherban
[email protected] LinkedIn:
This presentation on SlideShare:
https://realm.io/news/benji-encz-unidirectional-data-flow-swift/:https://github.com/ReSwift/ReSwift
Links:
https://reswift.github.io/ReSwift/master/getting-started-guide.html