Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
MVI (Model-View-Intention)
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Kapil Rathore
February 29, 2020
Programming
1
74
MVI (Model-View-Intention)
Presented on 29 February 2020 at Swift India.
https://www.meetup.com/Swift-Delhi/events/268573479/
Kapil Rathore
February 29, 2020
Tweet
Share
Other Decks in Programming
See All in Programming
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.9k
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
380
Fragmented Architectures
denyspoltorak
0
160
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
130
SourceGeneratorのススメ
htkym
0
200
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
130
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
170
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.4k
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
280
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
170
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
180
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
270
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
14k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
190
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Automating Front-end Workflow
addyosmani
1371
200k
A better future with KSS
kneath
240
18k
Deep Space Network (abreviated)
tonyrice
0
49
Statistics for Hackers
jakevdp
799
230k
Side Projects
sachag
455
43k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
4 Signs Your Business is Dying
shpigford
187
22k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
310
How STYLIGHT went responsive
nonsquared
100
6k
Transcript
Kapil Rathore iOS @ Tokopedia MVI (Model-View-Intention) Reactive Unidirectional Architecture
for your Apps @krkapilrathore @krkapilrathore @kapilrathore
What are you doing this weekend ? ♂
♂ I’m attending Swift Delhi Meetup
♂ Should I also join ?
♂ Sure, it’ll be fun !!
♂
♂ ⌨ INPUT OUTPUT OUTPUT INPUT
♂ ⌨ View ( ) User ( ) Model (
) Intention ( )
user ( )
intention ( user ( ) )
model ( intention ( user ( ) ) )
view ( model ( intention ( user ( ) )
) )
view ( model ( intention ( ) ) )
Pure Functions
Pure Functions ✅ ❌
Intention • Take the inputs from the user • Map
the user inputs to Model friendly events • Eg - button click events, text input events etc.
Model • Take the inputs from Intention • Processes a
particular business Usecase based on the input • Produces a New State as an output • Only piece of code that is allowed to change the State
• Immutable data structure • Holds all the important information
required to change the dynamic data on the UI layer • Acts as the single source of truth State
• Takes the output State produced by the Model as
input • Contains the rendering logic for the emitted state View
Rx Operators that we are going to use
Observable Sequence
None
None
None
Talk is cheap. Show me the code. - Linus Torvalds
Example App Counter MVI
Planning Intentions • Increment • Decrement • Reset Counter •
Interval Change
Code Intentions
Planning State • Count Value • Interval
Code State
Planning Model Usecases • Increment Usecase • Decrement Usecase •
Reset Counter Usecase • Interval Change Usecase
Code Increment Usecase
Code State
Code Decrement Usecase
Code Reset Counter Usecase
Code Interval Change Usecase
Intention View Different Model Usecases
BIND function - Model
Code View
Glue Code Outlets
Glue Code Initialize MVI Components
Glue Code Binding the MVI Components
Glue Code Implement the View Layer
Live Preview in Simulator
Summary Pros • Unidirectional & Cyclic Flow of Data •
Decoupled Code • Predictable (Pure functions + Immutable States) • Highly Testable & Debuggable (Encourages TDD) • User Centric (User drives the architecture) • Reactive (Handles the async code) • Platform Agnostic (Cross platform collaboration)
Summary Cons • Lots of Boilerplate • Where to place
navigation logic • Complexity (Learning Curve)
What’s Next + Combine Cook MVI using SwiftUI and Combine
References • What if the user was a function? by
Andre Staltz at JSConf Budapest 2015 • Managing State with RxJava by Jake Wharton • Mobius by Spotify • MVI Series: A Pragmatic Reactive Architecture for Android
Kapil Rathore iOS @ Tokopedia Questions @krkapilrathore @krkapilrathore @kapilrathore
Kapil Rathore iOS @ Tokopedia Thank You @krkapilrathore @krkapilrathore @kapilrathore