+ All Categories
Home > Engineering > Redux in iOS

Redux in iOS

Date post: 21-Feb-2017
Category:
Upload: viktor-shcherban
View: 209 times
Download: 0 times
Share this document with a friend
16
Redux in iOS: Unidirectional app flow Viktor Shcherban iOS Developer @ [email protected]
Transcript
Page 1: Redux in iOS

Redux in iOS: Unidirectional app flow

Viktor Shcherban

iOS Developer @[email protected]

Page 2: Redux in iOS

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

Page 3: Redux in iOS

Model View Controller

15 Feb 2017 1. intro to Redux and unidirectional flow

Page 4: Redux in iOS

Redux at a glance

15 Feb 2017 1. intro to Redux and unidirectional flow

Page 5: Redux in iOS

15 Feb 2017 1. intro to Redux and unidirectional flow

Redux + details

Page 6: Redux in iOS

Reducer

ACTION

STATE

PURE* FUNCTION

reducer

*No side effects, testable

15 Feb 2017

NEW STATE

1. intro to Redux and unidirectional flow

Page 7: Redux in iOS

update UI by changing state object

UI = f(state)

Philosophy

Page 8: Redux in iOS

Time Travel !

15 Feb 2017 1. intro to Redux and unidirectional flow

Page 9: Redux in iOS

Code Demo

15 Feb 2017 2. integrating Redux (ReSwift)

https://github.com/ReSwift/ReSwiftReSwift by @benjaminencz

Page 10: Redux in iOS

SubState

15 Feb 2017 2. integrating Redux (ReSwift)

subState1

Store

subState2

Reducer1

subState1

subState1

View1

View2

Observer

Reducer2

Page 11: Redux in iOS

Model-View-Controller

Repository

Service

Provider

Singleton

DB

Network

15 Feb 2017 2. integrating Redux (ReSwift)

App Structure

Page 12: Redux in iOS

View

Repository

Service

Provider

DB

NetworkRedux

15 Feb 2017 2. integrating Redux (ReSwift)

App Structure with Redux

Page 13: Redux in iOS

• use ReSwift or your own implementation

• don’t keep everything in the AppState

15 Feb 2017 3. Conclusions

Page 14: Redux in iOS

• 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

Page 15: Redux in iOS

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

Page 16: Redux in iOS

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


Recommended