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
DAloG
November 01, 2015
Programming
0
94
Using Future
I will try to explore concept of Async state and Future monad
DAloG
November 01, 2015
Tweet
Share
More Decks by DAloG
See All by DAloG
State normalization (RU)
dalog
0
200
Redux + MQTT
dalog
1
780
От задач к проблемам
dalog
1
260
Unlimited power of Data-Driven UI
dalog
4
650
Data-Driven View Controllers. Tips and Tricks
dalog
5
1.9k
2 years of Redux in iOS. Lessons learned
dalog
0
380
Why unidirectional architecture matter for iOS.
dalog
1
290
Mobile backend without REST
dalog
2
110
Self managed teams 101
dalog
0
150
Other Decks in Programming
See All in Programming
時間軸から考えるTerraformを使う理由と留意点
fufuhu
16
4.8k
print("Hello, World")
eddie
2
530
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
もうちょっといいRubyプロファイラを作りたい (2025)
osyoyu
1
440
Design Foundational Data Engineering Observability
sucitw
3
200
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
3
300
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
220
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
320
機能追加とリーダー業務の類似性
rinchoku
2
1.3k
testingを眺める
matumoto
1
140
HTMLの品質ってなんだっけ? “HTMLクライテリア”の設計と実践
unachang113
4
2.9k
Android 16 × Jetpack Composeで縦書きテキストエディタを作ろう / Vertical Text Editor with Compose on Android 16
cc4966
1
230
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.8k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Designing Experiences People Love
moore
142
24k
Balancing Empowerment & Direction
lara
3
620
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Producing Creativity
orderedlist
PRO
347
40k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
How to Ace a Technical Interview
jacobian
279
23k
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