SlideShare a Scribd company logo
@nikolasburkState Management & Unidirectional Data Flow
State Management &
Unidirectional Data Flow
“Where is truth in your application?”
Andy Matuschak, WWDC 2014
Nikolas Burk
@nikolasburk
• Developer at Graphcool
• Experienced with iOS
• Passionate about programming
paradigms and architecture
1. State Management
2. Unidirectional Data Flow & ReSwift
@nikolasburkState Management & Unidirectional Data Flow
Goals 🎯
State Management
…and why it matters to you
@nikolasburkState Management & Unidirectional Data Flow
@nikolasburkState Management & Unidirectional Data Flow
An Application is more than the
Happy Path
“In the context of software or
information modeling, a happy
path is a default scenario
featuring no exceptional or error
conditions.”
Wikipedia 😏
@nikolasburkState Management & Unidirectional Data Flow
Decision process
for
Slack Notifications
The application state represents the
information that is kept in memory of a
running application and is the basis for the
generation of a user interface.
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
The application state represents the
information that is kept in memory of a
running application and is the basis for the
generation of a user interface.
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
The application state represents the
information that is kept in memory of a
running application and is the basis for
the generation of a user interface.
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
@nikolasburkState Management & Unidirectional Data Flow
The main responsibility of an app is to
transform an application state into a user interface.
(AppState) -> UI
Example: Conference Planner App 🗓
@nikolasburkState Management & Unidirectional Data Flow
struct Conference {
let name: String
let city: String
let year: String
var attending: Bool
}
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
conferences = [
Conference(
name: "AppDevcon",
city: "Amsterdam",
year: "2017",
attending: true
),
Conference(
name: "UIKonf",
city: "Berlin",
year: "2017",
attending: false
),
Conference(
name: "WWDC",
city: "San Jose",
year: "2017",
attending: true
)
]
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
conferences = [
Conference(
name: "AppDevcon",
city: "Amsterdam",
year: "2017",
attending: true
),
Conference(
name: "UIKonf",
city: "Berlin",
year: "2017",
attending: false
),
Conference(
name: "WWDC",
city: "San Jose",
year: "2017",
attending: true
)
]
selectedIndex = 0
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
conferences = [
Conference(
name: "AppDevcon",
city: "Amsterdam",
year: "2017",
attending: true
),
Conference(
name: "UIKonf",
city: "Berlin",
year: "2017",
attending: false
),
Conference(
name: "WWDC",
city: "San Jose",
year: "2017",
attending: true
)
]
selectedIndex = nil
@nikolasburkState Management & Unidirectional Data Flow
1. Where should the state live?
2. Who is allowed to change the state?
3. How does the state get changed?
3 Golden Questions of
State Management 👑
An architectural pattern should be able to answer these questions!
@nikolasburkState Management & Unidirectional Data Flow
Model View Controller
@nikolasburkState Management & Unidirectional Data Flow
Where should state live?
1 👑
@nikolasburkState Management & Unidirectional Data Flow
Who is allowed to change the state?
2 👑
@nikolasburkState Management & Unidirectional Data Flow
How does the state get changed?
KVO & Property Observers
Delegates
Callbacks NSNotificationCenter
Target-Action
3 👑
@nikolasburkState Management & Unidirectional Data Flow
UIViewController
What’s wrong with MVC?
Persistence
Networking
Navigation
Domain Logic
User Interface
Concurrency
@nikolasburkState Management & Unidirectional Data Flow
State Management is
hard
and MVC is not a solution, thanks Apple 😑
Unidirectional Data Flow
… and controlling your application state with ReSwift
@nikolasburkState Management & Unidirectional Data Flow
•
3 Principles
• Single source of truth
• State is read-only
• Changes with pure functions
http://redux.js.org/docs/introduction/ThreePrinciples.html
@nikolasburkState Management & Unidirectional Data Flow
Main Concepts
Store:
… manages the application state
… informs subscribers about changes
Actions:
… describe an intent to change the state
Reducer:
… pure functions that generate a new
application state based on actions
Example Flow
@nikolasburkState Management & Unidirectional Data Flow
Application
State (Old)
AppDevcon
UIKonf
WWDC
Reducer
add Swift Summit
to list and return new
application state
Action
“Swift Summit”
“San Francisco”
“2017”
Application
State (New)
AppDevcon
UIKonf
WWDC
Swift Summit
@nikolasburkState Management & Unidirectional Data Flow
Helpful Resources 📚
• Unidirectional Data Flow in Swift: An Alternative to Massive View
Controllers (Video) (https://realm.io/news/benji-encz-
unidirectional-data-flow-swift/)
• Real World Flux Architecture on iOS (http://blog.benjamin-
encz.de/post/real-world-flux-ios/)
• Redux Documentation (http://redux.js.org/)
• Advanced iOS Application Architecture and Patterns, Andy
Matuschak WWDC 2014 (Video) (http://asciiwwdc.com/2014/
sessions/229)
DEMO
Conference Planner App
State Management & Unidirectional Data Flow
Thank you! 🤓
@nikolasburk

More Related Content

PDF
Summer Internship (Report)
PPTX
Internship Presentation
PDF
Cross Matching EUCLID and SKA using the Likelihood Ratio
PDF
Internship report
DOCX
RESUME Dr. TAREK 2014 aug
PDF
Bharat Forge Project Report
PPT
Internship Presentation - Software Testing and Content Creator
PDF
Unit 8 book
Summer Internship (Report)
Internship Presentation
Cross Matching EUCLID and SKA using the Likelihood Ratio
Internship report
RESUME Dr. TAREK 2014 aug
Bharat Forge Project Report
Internship Presentation - Software Testing and Content Creator
Unit 8 book

What's hot (20)

DOCX
PDF
Going Mobile with React Native and WebRTC
PDF
Digital Health
PDF
Electrical Engineer CV -Mostafa Abdeltwab
PDF
OFFICIAL_TRANSCRIPT
PDF
Rage against the machine learning 2023
PDF
Final Intern Presentation-Keyur
PDF
Transcript of Records
PPTX
Andreas Kyprianou: People Analytics in startups - an impossible task?- Andrea...
PPTX
MPH NLEP PPT go for live and happy new year for all
PDF
Retail Banking in the New Reality – Summary Survey Findings
PDF
Post University Official Transcript (1)
PDF
Pierce College Transcript
PDF
Taiyi fiber laser marking machine manual english edition
PDF
Academic Transcript--Undergraduate
PDF
ge-healthcare-investor-day-presentation.pdf
PDF
Texas State Transcript
PDF
Final Internship presentation
DOCX
Jyoti cnc project report
PDF
Max Blumberg: How can #PeopleAnalytics prevent incidents like the Twitter fir...
Going Mobile with React Native and WebRTC
Digital Health
Electrical Engineer CV -Mostafa Abdeltwab
OFFICIAL_TRANSCRIPT
Rage against the machine learning 2023
Final Intern Presentation-Keyur
Transcript of Records
Andreas Kyprianou: People Analytics in startups - an impossible task?- Andrea...
MPH NLEP PPT go for live and happy new year for all
Retail Banking in the New Reality – Summary Survey Findings
Post University Official Transcript (1)
Pierce College Transcript
Taiyi fiber laser marking machine manual english edition
Academic Transcript--Undergraduate
ge-healthcare-investor-day-presentation.pdf
Texas State Transcript
Final Internship presentation
Jyoti cnc project report
Max Blumberg: How can #PeopleAnalytics prevent incidents like the Twitter fir...
Ad

Similar to State Management & Unidirectional Data Flow (20)

PDF
State management for enterprise angular applications
PDF
What is State Management In Flutter_.pdf
PDF
What 100M downloads taught us about iOS architectures
PDF
Towards Aspect Oriented Adaptive Case Management
PDF
De-Crudding Apps with Event Sourcing
PDF
Flutter state management from zero to hero
PDF
State Management in Angular/React
PDF
Are statecharts the next big UI paradigm?
PDF
Workflow automation i phone application for a construction company
PDF
Jetpack Compose untuk UI Masa Depan Bagian 2 - Sidiq Permana
PDF
Try flutter - state management
PDF
Managing application-state-final
PDF
React London April- Fully functional: Central state is a great fit for React ...
PDF
Unidirectional Data Flow Architecture (Redux) in Swift
PDF
React state managmenet with Redux
PPTX
Best Website Designing Company in Amritsar for Mobile-Responsive Sites
PDF
Application for Data Sync Between Different geo Locations
PDF
JS Experience 2017 - Reactive Interfaces com React & RxJS
PDF
Free advertising platform for businesses with IOS & Android Apps development
PDF
Free advertising platform for businesses with IOS & Android Apps development
State management for enterprise angular applications
What is State Management In Flutter_.pdf
What 100M downloads taught us about iOS architectures
Towards Aspect Oriented Adaptive Case Management
De-Crudding Apps with Event Sourcing
Flutter state management from zero to hero
State Management in Angular/React
Are statecharts the next big UI paradigm?
Workflow automation i phone application for a construction company
Jetpack Compose untuk UI Masa Depan Bagian 2 - Sidiq Permana
Try flutter - state management
Managing application-state-final
React London April- Fully functional: Central state is a great fit for React ...
Unidirectional Data Flow Architecture (Redux) in Swift
React state managmenet with Redux
Best Website Designing Company in Amritsar for Mobile-Responsive Sites
Application for Data Sync Between Different geo Locations
JS Experience 2017 - Reactive Interfaces com React & RxJS
Free advertising platform for businesses with IOS & Android Apps development
Free advertising platform for businesses with IOS & Android Apps development
Ad

More from Nikolas Burk (17)

PDF
Next-generation API Development with GraphQL and Prisma
PDF
Code-first GraphQL Server Development with Prisma
PDF
GraphQL & Prisma from Scratch
PDF
GraphQL Schema Stitching with Prisma & Contentful
PDF
Managing GraphQL servers with AWS Fargate & Prisma Cloud
PDF
Building GraphQL Servers with Node.JS & Prisma
PDF
The GraphQL Ecosystem in 2018
PDF
React & GraphQL
PDF
Building Serverless GraphQL Backends
PDF
GraphQL Subscriptions
PDF
The Serverless GraphQL Backend Architecture
PDF
Diving into GraphQL, React & Apollo
PDF
Authentication, Authorization & Error Handling with GraphQL
PDF
Getting Started with Relay Modern
PDF
Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions
PDF
Building a Realtime Chat with React & GraphQL Subscriptions
PDF
REST in Peace - Using GraphQL with Apollo on iOS
Next-generation API Development with GraphQL and Prisma
Code-first GraphQL Server Development with Prisma
GraphQL & Prisma from Scratch
GraphQL Schema Stitching with Prisma & Contentful
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Building GraphQL Servers with Node.JS & Prisma
The GraphQL Ecosystem in 2018
React & GraphQL
Building Serverless GraphQL Backends
GraphQL Subscriptions
The Serverless GraphQL Backend Architecture
Diving into GraphQL, React & Apollo
Authentication, Authorization & Error Handling with GraphQL
Getting Started with Relay Modern
Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions
Building a Realtime Chat with React & GraphQL Subscriptions
REST in Peace - Using GraphQL with Apollo on iOS

Recently uploaded (20)

PPTX
ai tools demonstartion for schools and inter college
PDF
System and Network Administration Chapter 2
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
System and Network Administraation Chapter 3
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
history of c programming in notes for students .pptx
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Essential Infomation Tech presentation.pptx
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
ai tools demonstartion for schools and inter college
System and Network Administration Chapter 2
PTS Company Brochure 2025 (1).pdf.......
System and Network Administraation Chapter 3
Softaken Excel to vCard Converter Software.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
Design an Analysis of Algorithms II-SECS-1021-03
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
wealthsignaloriginal-com-DS-text-... (1).pdf
history of c programming in notes for students .pptx
VVF-Customer-Presentation2025-Ver1.9.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
top salesforce developer skills in 2025.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Odoo Companies in India – Driving Business Transformation.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Navsoft: AI-Powered Business Solutions & Custom Software Development
Essential Infomation Tech presentation.pptx
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf

State Management & Unidirectional Data Flow

  • 1. @nikolasburkState Management & Unidirectional Data Flow State Management & Unidirectional Data Flow “Where is truth in your application?” Andy Matuschak, WWDC 2014
  • 2. Nikolas Burk @nikolasburk • Developer at Graphcool • Experienced with iOS • Passionate about programming paradigms and architecture
  • 3. 1. State Management 2. Unidirectional Data Flow & ReSwift @nikolasburkState Management & Unidirectional Data Flow Goals 🎯
  • 4. State Management …and why it matters to you
  • 5. @nikolasburkState Management & Unidirectional Data Flow
  • 6. @nikolasburkState Management & Unidirectional Data Flow An Application is more than the Happy Path “In the context of software or information modeling, a happy path is a default scenario featuring no exceptional or error conditions.” Wikipedia 😏
  • 7. @nikolasburkState Management & Unidirectional Data Flow Decision process for Slack Notifications
  • 8. The application state represents the information that is kept in memory of a running application and is the basis for the generation of a user interface. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow
  • 9. The application state represents the information that is kept in memory of a running application and is the basis for the generation of a user interface. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow
  • 10. The application state represents the information that is kept in memory of a running application and is the basis for the generation of a user interface. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow
  • 11. @nikolasburkState Management & Unidirectional Data Flow The main responsibility of an app is to transform an application state into a user interface. (AppState) -> UI
  • 12. Example: Conference Planner App 🗓 @nikolasburkState Management & Unidirectional Data Flow struct Conference { let name: String let city: String let year: String var attending: Bool }
  • 13. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow conferences = [ Conference( name: "AppDevcon", city: "Amsterdam", year: "2017", attending: true ), Conference( name: "UIKonf", city: "Berlin", year: "2017", attending: false ), Conference( name: "WWDC", city: "San Jose", year: "2017", attending: true ) ]
  • 14. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow conferences = [ Conference( name: "AppDevcon", city: "Amsterdam", year: "2017", attending: true ), Conference( name: "UIKonf", city: "Berlin", year: "2017", attending: false ), Conference( name: "WWDC", city: "San Jose", year: "2017", attending: true ) ] selectedIndex = 0
  • 15. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow conferences = [ Conference( name: "AppDevcon", city: "Amsterdam", year: "2017", attending: true ), Conference( name: "UIKonf", city: "Berlin", year: "2017", attending: false ), Conference( name: "WWDC", city: "San Jose", year: "2017", attending: true ) ] selectedIndex = nil
  • 16. @nikolasburkState Management & Unidirectional Data Flow 1. Where should the state live? 2. Who is allowed to change the state? 3. How does the state get changed? 3 Golden Questions of State Management 👑 An architectural pattern should be able to answer these questions!
  • 17. @nikolasburkState Management & Unidirectional Data Flow Model View Controller
  • 18. @nikolasburkState Management & Unidirectional Data Flow Where should state live? 1 👑
  • 19. @nikolasburkState Management & Unidirectional Data Flow Who is allowed to change the state? 2 👑
  • 20. @nikolasburkState Management & Unidirectional Data Flow How does the state get changed? KVO & Property Observers Delegates Callbacks NSNotificationCenter Target-Action 3 👑
  • 21. @nikolasburkState Management & Unidirectional Data Flow UIViewController What’s wrong with MVC? Persistence Networking Navigation Domain Logic User Interface Concurrency
  • 22. @nikolasburkState Management & Unidirectional Data Flow State Management is hard and MVC is not a solution, thanks Apple 😑
  • 23. Unidirectional Data Flow … and controlling your application state with ReSwift
  • 24. @nikolasburkState Management & Unidirectional Data Flow • 3 Principles • Single source of truth • State is read-only • Changes with pure functions http://redux.js.org/docs/introduction/ThreePrinciples.html
  • 25. @nikolasburkState Management & Unidirectional Data Flow Main Concepts Store: … manages the application state … informs subscribers about changes Actions: … describe an intent to change the state Reducer: … pure functions that generate a new application state based on actions
  • 26. Example Flow @nikolasburkState Management & Unidirectional Data Flow
  • 27. Application State (Old) AppDevcon UIKonf WWDC Reducer add Swift Summit to list and return new application state Action “Swift Summit” “San Francisco” “2017” Application State (New) AppDevcon UIKonf WWDC Swift Summit
  • 28. @nikolasburkState Management & Unidirectional Data Flow Helpful Resources 📚 • Unidirectional Data Flow in Swift: An Alternative to Massive View Controllers (Video) (https://realm.io/news/benji-encz- unidirectional-data-flow-swift/) • Real World Flux Architecture on iOS (http://blog.benjamin- encz.de/post/real-world-flux-ios/) • Redux Documentation (http://redux.js.org/) • Advanced iOS Application Architecture and Patterns, Andy Matuschak WWDC 2014 (Video) (http://asciiwwdc.com/2014/ sessions/229)