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
Underscore.m + Asterism
Search
Robert Böhnke
August 21, 2013
Programming
4
1.2k
Underscore.m + Asterism
My talk on Underscore.m and Asterism for CocoaHeads Berlin
Robert Böhnke
August 21, 2013
Tweet
Share
More Decks by Robert Böhnke
See All by Robert Böhnke
Brooklyn iOS Developer Meetup February 2014
robb
8
2.8k
Cocoa Kucha Berlin 2013
robb
2
2k
ReactiveCocoa NSSpain
robb
18
2.3k
ReactiveCocoa
robb
19
2.6k
Super Mario Masterclass
robb
2
260
Tetris Masterclass
robb
0
490
Other Decks in Programming
See All in Programming
ADRを一年運用してみた/adr_after_a_year
hanhan1978
7
2.4k
Kotlin Multiplatform at Stable and Beyond (Android Makers 2024)
zsmb
0
320
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
270
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
430
PHPはいつから死んでいるかの調査
chiroruxx
1
400
見た目から始める生産性向上
ikumatadokoro
8
990
try! Swift Tokyo 初参加報告LT
hinakko2
0
220
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
110
大規模Reactアプリのリアーキテクチャ~8万行のTanStack Query移行の軌跡~
kj455
4
980
Java 22 Overview
kishida
1
190
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
130
Blue/Greenデプロイの導入による 運用フローの改善
kudoas
1
390
Featured
See All Featured
Navigating Team Friction
lara
178
13k
We Have a Design System, Now What?
morganepeng
43
6.8k
Scaling GitHub
holman
457
140k
Six Lessons from altMBA
skipperchong
21
3k
Build The Right Thing And Hit Your Dates
maggiecrowley
24
2k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
The Invisible Customer
myddelton
114
12k
Making Projects Easy
brettharned
108
5.5k
Git: the NoSQL Database
bkeepers
PRO
422
63k
For a Future-Friendly Web
brad_frost
172
9k
Faster Mobile Websites
deanohume
299
30k
A Tale of Four Properties
chriscoyier
151
22k
Transcript
[email protected]
github.com/robb
Let's talk about
Let's talk about Objective-C
Let's talk about Objective-C talk about
[ ]
transitionFromViewController: toViewController: duration: options: animations: completion:
videoComposition: shouldContinueValidatingAfter FindingInvalidTrackIDInInstruction: layerInstruction: asset:
predicateWithLeftExpression: rightExpression: modifier: type: helpMe: iAmTrappedInAMethodFactory: options:
//
new Grapefruit(0, 10);
[CHGrapefruit grapefruitWithSeeds:0 tastiness:10];
duh!
[NSDictionary dictionaryWithObjectsAndKeys:value, key, nil];
@{ key: value }
enumerateObjectsUsingBlock:
enumerateKeysAndObjectsUsingBlock:
each?
map?
reduce?
filter?
Underscore.m
inspired by underscore.js
not trying to turn Objective-C into JavaScript
not trying to turn Objective-C into JavaScript though it looks
kinda like it…
DSL for data manipulation
Underscore.wrap(array) .filter(^(id obj) { return [obj tastiness] > 8; })
.map(^(id obj) { return [obj juice]; }) .unwrap;
wtf?
@property USDictWrapper *(^map)(USMapBlock block);
foo.method1().method2();
// Nocilla stubRequest(@"GET", @"https://api.example.com") .withHeader(@"Accept", @"application/json");
// Expecta expect(CocoaHeads).to.beFun();
but
- (NSDictionary *)us_map:(USMapBlock block);
[[dictionary us_map:^(id key, id value) { return …; }] us_filter:^(id
object) { return …; }];
Check out BlocksKit
DSL
github.com/robb/Underscore.m
Asterism
Underscore.dictWrap(dictionary).map(block).unwrap; Underscore.arrayWrap(array).map(block).unwrap;
Underscore.dictMap(dictionary, block); Underscore.arrayMap(array, block);
Underscore.dictEach(dictionary, block); Underscore.arrayEach(array, block);
Asterism
__attribute__((overloadable))
ASTEach(NSArray *array, void(^block)(id obj)); ASTEach(NSArray *array, void(^block)(id obj, NSUInteger idx));
ASTEach(NSSet *set, void(^block)(id obj)); …
github.com/robb/Underscore.m github.com/robb/Asterism
thanks!