Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
[email protected]
github.com/robb
Slide 2
Slide 2 text
Let's talk about
Slide 3
Slide 3 text
Let's talk about Objective-C
Slide 4
Slide 4 text
Let's talk about Objective-C talk about
Slide 5
Slide 5 text
[ ]
Slide 6
Slide 6 text
transitionFromViewController: toViewController: duration: options: animations: completion:
Slide 7
Slide 7 text
videoComposition: shouldContinueValidatingAfter FindingInvalidTrackIDInInstruction: layerInstruction: asset:
Slide 8
Slide 8 text
predicateWithLeftExpression: rightExpression: modifier: type: helpMe: iAmTrappedInAMethodFactory: options:
Slide 9
Slide 9 text
//
Slide 10
Slide 10 text
new Grapefruit(0, 10);
Slide 11
Slide 11 text
[CHGrapefruit grapefruitWithSeeds:0 tastiness:10];
Slide 12
Slide 12 text
duh!
Slide 13
Slide 13 text
[NSDictionary dictionaryWithObjectsAndKeys:value, key, nil];
Slide 14
Slide 14 text
@{ key: value }
Slide 15
Slide 15 text
enumerateObjectsUsingBlock:
Slide 16
Slide 16 text
enumerateKeysAndObjectsUsingBlock:
Slide 17
Slide 17 text
each?
Slide 18
Slide 18 text
map?
Slide 19
Slide 19 text
reduce?
Slide 20
Slide 20 text
filter?
Slide 21
Slide 21 text
Underscore.m
Slide 22
Slide 22 text
inspired by underscore.js
Slide 23
Slide 23 text
not trying to turn Objective-C into JavaScript
Slide 24
Slide 24 text
not trying to turn Objective-C into JavaScript though it looks kinda like it…
Slide 25
Slide 25 text
DSL for data manipulation
Slide 26
Slide 26 text
Underscore.wrap(array) .filter(^(id obj) { return [obj tastiness] > 8; }) .map(^(id obj) { return [obj juice]; }) .unwrap;
Slide 27
Slide 27 text
wtf?
Slide 28
Slide 28 text
@property USDictWrapper *(^map)(USMapBlock block);
Slide 29
Slide 29 text
foo.method1().method2();
Slide 30
Slide 30 text
// Nocilla stubRequest(@"GET", @"https://api.example.com") .withHeader(@"Accept", @"application/json");
Slide 31
Slide 31 text
// Expecta expect(CocoaHeads).to.beFun();
Slide 32
Slide 32 text
but
Slide 33
Slide 33 text
- (NSDictionary *)us_map:(USMapBlock block);
Slide 34
Slide 34 text
[[dictionary us_map:^(id key, id value) { return …; }] us_filter:^(id object) { return …; }];
Slide 35
Slide 35 text
Check out BlocksKit
Slide 36
Slide 36 text
DSL
Slide 37
Slide 37 text
github.com/robb/Underscore.m
Slide 38
Slide 38 text
Asterism
Slide 39
Slide 39 text
Underscore.dictWrap(dictionary).map(block).unwrap; Underscore.arrayWrap(array).map(block).unwrap;
Slide 40
Slide 40 text
Underscore.dictMap(dictionary, block); Underscore.arrayMap(array, block);
Slide 41
Slide 41 text
Underscore.dictEach(dictionary, block); Underscore.arrayEach(array, block);
Slide 42
Slide 42 text
Asterism
Slide 43
Slide 43 text
__attribute__((overloadable))
Slide 44
Slide 44 text
ASTEach(NSArray *array, void(^block)(id obj)); ASTEach(NSArray *array, void(^block)(id obj, NSUInteger idx)); ASTEach(NSSet *set, void(^block)(id obj)); …
Slide 45
Slide 45 text
github.com/robb/Underscore.m github.com/robb/Asterism
Slide 46
Slide 46 text
thanks!