Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
λ is coming to Obj-C – ReactiveCocoa
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Vladimir Burdukov
December 07, 2013
Programming
410
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
λ is coming to Obj-C – ReactiveCocoa
Vladimir Burdukov
December 07, 2013
More Decks by Vladimir Burdukov
See All by Vladimir Burdukov
Alice in robovacuum land
chipp
0
76
It’s time to migrate from RxSwift to Combine. Long story short
chipp
0
110
Decodable vs real-world JSON
chipp
0
95
`fastlane beta` 2 или почему я стал пить больше кофе
chipp
0
660
`fastlane beta` или почему я стал пить больше кофе
chipp
0
160
Архитектурные излишества в iOS приложениях Superjob
chipp
0
230
λ is coming to Obj-C – ReactiveCocoa
chipp
1
150
Build bots
chipp
0
130
Other Decks in Programming
See All in Programming
Next.js: The final boss of Web Performance
guaca
0
260
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
210
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
1.1k
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
0
1k
ActionController meets Protocol Buffers
sorah
0
520
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
2
550
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
170
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
Featured
See All Featured
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
850
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
540
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
The Limits of Empathy - UXLibs8
cassininazir
2
720
We Have a Design System, Now What?
morganepeng
55
8.4k
The Curse of the Amulet
leimatthew05
3
16k
Agile that works and the tools we love
rasmusluckow
331
22k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Embracing the Ebb and Flow
colly
88
5.2k
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Making Projects Easy
brettharned
120
6.8k
Transcript
λ is coming to Obj-C: ReactiveCocoa Vladimir @chippcheg Burdukov Lead
Hipster Developer at HiQo Solutions
State
Let’s enumerate NSMutableArray
Functional programming
Stateless
Stateless Composition
Stateless Composition Concurrency https://class.coursera.org/progfun-003/class http://twitter.github.io/scala_school/index.html
Composition
Composition package cocoaheads ! object cocoaheads { def fib(n: Int):
List[Int] = { def tail(n: Int, p: Int, m: Int): List[Int] = if (n == 1) List(p) else p :: tail(n - 1, m, p + m) tail(n, 1, 1) } //> fib: (n: Int)List[Int] fib(4) //> res0: List[Int] = List(1, 1, 2, 3) fib(4).zip(fib(4).map((x: Int) => x * x)) //> res1: List[(Int, Int)] = List((1,1), (1,1), (2,4), (3,9)) fib(4).foldLeft(0)((m: Int, n: Int) => m + n) //> res2: Int = 7 } http://bcomposes.wordpress.com/2011/08/20/fun-with- function-composition-in-scala/
Functional Programming
Functional Reactive Programming
Functional Reactive Programming
ReactiveCocoa Next step of Objective-C evolution https://github.com/ReactiveCocoa/ReactiveCocoa/
Introduction https://github.com/ReactiveCocoa/ReactiveCocoa/blob/master/ Documentation/
RACStream RACSequense RACSignal
RACSignal
RACSignal RACSignal *signal = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { if
(value) { [subscriber sendNext:value]; [subscriber sendCompleted]; } else { [subscriber sendError:error]; } return nil; }];
RACSignal [signal subscribeNext:^(id x) { NSLog(@"SIGNAL NEW VALUE: %@", x);
} error:^(NSError *error) { NSLog(@"SIGNAL ERROR: %@", error); } completed:^{ NSLog(@"SIGNAL COMPLETED"); }]; RACSignal *signal = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { if (value) { [subscriber sendNext:value]; [subscriber sendCompleted]; } else { [subscriber sendError:error]; } return nil; }];
RACSignal *loginEditingSignal = [[self.loginField rac_signalForControlEvents:UIControlEventEditingChanged] map:^id(UITextField *x) { return @(x.isEditing);
}]; ! RACSignal *passwordEditingSignal = [[self.passwordField rac_signalForControlEvents:UIControlEventEditingChanged] map:^id(UITextField *x) { return @(x.isEditing); }]; RAC(self.tapGestureRecognizer, enabled) = [RACSignal combineLatest:@[loginEditingSignal, passwordEditingSignal] reduce:^id(NSNumber *loginIsEditing, NSNumber *passwordIsEditing){ return @([loginIsEditing boolValue] || [passwordIsEditing boolValue]); }]; RACSignal Combining
RACSequence
RACSequence RACSequence *fib(int n) { return fibTail(n, 1, 1); }
! RACSequence *fibTail(int n, int p, int m) { return [RACSequence sequenceWithHeadBlock:^NSNumber *{ return @(p); } tailBlock:^RACSequence *{ if (n == 1) { return [RACSequence empty]; } else { return fibTail(n - 1, m, p + m); } }]; } ! NSLog(@"%@", fib(4).array); // [1, 1, 2, 3] ! NSLog(@"%@", [fib(4) zipWith:[fib(4) map:^NSNumber *(NSNumber *value) { return @([value integerValue] * [value integerValue]); }]].array); // [(1, 1), (1, 1), (2, 4), (3, 9)] ! NSLog(@"%@", [fib(4) foldLeftWithStart:@0 reduce:^NSNumber *(NSNumber *accumulator, NSNumber *value) { return @(accumulator.integerValue + value.integerValue); }]); // 7
RACDisposable
RACScheduler
Binding RAC(avatarImageView, image) = RACObserve(self.viewModel, userAvatar);
ReactiveCocoa UI extensions • UIActionSheet / UIAlertView • UIButton •
UITableViewCell • UIControl (rac_signalForControlEvents:) • UIGestureRecognizer • UITextField
Conclusion
Questions