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
73
It’s time to migrate from RxSwift to Combine. Long story short
chipp
0
110
Decodable vs real-world JSON
chipp
0
91
`fastlane beta` 2 или почему я стал пить больше кофе
chipp
0
650
`fastlane beta` или почему я стал пить больше кофе
chipp
0
150
Архитектурные излишества в iOS приложениях Superjob
chipp
0
220
λ is coming to Obj-C – ReactiveCocoa
chipp
1
140
Build bots
chipp
0
130
Other Decks in Programming
See All in Programming
XHTMLが残したもの
yosuke_furukawa
PRO
2
700
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
470
業務時間外もAIに働いてもらう話
colorful12
3
10k
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
2.7k
スマート反転とウェブアクセシビリティ
camiha
0
180
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
150
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
160
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
1.1k
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
240
Building an Out-of-Order CPU
latte72
1
750
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
220
Featured
See All Featured
Tell your own story through comics
letsgokoyo
1
1.1k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
520
Evolving SEO for Evolving Search Engines
ryanjones
0
280
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Code Reviewing Like a Champion
maltzj
528
40k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
270
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
410
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
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