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
Using Future
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
DAloG
November 01, 2015
Programming
97
0
Share
Using Future
I will try to explore concept of Async state and Future monad
DAloG
November 01, 2015
More Decks by DAloG
See All by DAloG
State normalization (RU)
dalog
0
230
Redux + MQTT
dalog
1
800
От задач к проблемам
dalog
1
280
Unlimited power of Data-Driven UI
dalog
4
690
Data-Driven View Controllers. Tips and Tricks
dalog
5
2k
2 years of Redux in iOS. Lessons learned
dalog
0
410
Why unidirectional architecture matter for iOS.
dalog
1
320
Mobile backend without REST
dalog
2
140
Self managed teams 101
dalog
0
190
Other Decks in Programming
See All in Programming
L’IA au service des devs : Anatomie d'un assistant de Code Review
toham
0
220
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
190
iOS機能開発のAI環境と起きた変化
ryunakayama
0
170
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
170
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
300
年間50登壇、単著出版、雑誌寄稿、Podcast出演、YouTube、CM、カンファレンス主催……全部やってみたので面白さ等を比較してみよう / I’ve tried them all, so let’s compare how interesting they are.
nrslib
4
760
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
5
2.5k
10 Tips of AWS ~Gen AI on AWS~
licux
5
200
事業会社でのセキュリティ長期インターンについて
masachikaura
0
240
飯MCP
yusukebe
0
490
Running Swift without an OS
kishikawakatsumi
0
730
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
9
5.3k
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
150
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.8k
Everyday Curiosity
cassininazir
0
190
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Chasing Engaging Ingredients in Design
codingconduct
0
170
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
720
Mobile First: as difficult as doing things right
swwweet
225
10k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Transcript
USING FUTURES @daloog
ABOUT skype: nobidon
[email protected]
https://speakerdeck.com/dalog
ASYNC VS PARALLEL
ASYNC DO THINGS AT DEFERENT TIME
PARALLEL DO THINGS AT THE SAME TIME
GCD
GCD
NSOPERATION
NSOPERATION
[ _ TARGET: ACTION: ]
DELEGATE
STRATEGY AND CALLBACK
BLOCK
CALLBACK!!!
SIGNATURE DANCE
None
None
None
None
None
None
None
None
None
None
SEPARATE WORK FROM RESULT DELIVERY
SETTER
T -> ()
GETTER
() -> T
T -> U IS (GET, SET) -> ()
T -> U (() -> T, U -> ()) ->
()
None
ASYNC?
ASYNC GETTER
() -> T (T -> ()) -> () SET ->
()
SET<T> -> () FUTURE<T>
ASYNC SETTER
T -> () () -> (T -> ()) () ->
SET
() -> SET<T> PROMISE<T>
GETTER + SETTER = STATE
PROMISE + FUTURE = ASYNC STATE
ASYNC STATE >>> STATE
WHY THIS IS SO HARD???
ACTUALLY NOT
THINK ABOUT FUTURE AS A BOX
BOX WILL BE OPENED. SOMEDAY. MAYBE.
A = B C = A
CHAIN?
T -> U U -> K T -> K
T -> F<U> U -> F<K> T -> F<K>
(F<U> , U -> F<K>) -> F<K>
AND THEN
FLAT MAP
ERROR?
TRY<T, E>
FUTURE<T, E> = FUTURE<TRY<T, E>>
WHAT CAN BE FUTURE?
ANYTHING
UI
USING FUTURES FOR REVERSING UI FLOW. HTTPS://MEDIUM.COM/P/D3F5B7CA32D9/ EDIT
VM -> F<ACTION>
NETWORK BLUETOOTH …
EXPOSE F<> AS PUBLIC API
ALWAYS
USE ANY LIB • https://github.com/BoltsFramework/Bolts-iOS • https://github.com/mxcl/PromiseKit • https://github.com/Thomvis/BrightFutures •
https://realm.io/news/swift-summit-javier-soto-futures/ • https://realm.io/news/swift-tasks-nevyn-bengtsson/
ALL LIBS EQUAL ITS JUST ASYNC STATE
FUTURE / PROMISE ASYNC GET/SET