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
Safer Objective-C
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Błażej Biesiada
January 27, 2014
Programming
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Safer Objective-C
Few tips on how to make your Objective-C code safer at compile time.
Błażej Biesiada
January 27, 2014
More Decks by Błażej Biesiada
See All by Błażej Biesiada
Objective-C Runtime Hacking
bejo
1
480
Other Decks in Programming
See All in Programming
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
380
カツオ、ご期待ください
suneo3476
0
190
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
470
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
AmebaブログはKMPから卒業します
kmars0605
0
190
contenteditable と日本語入力に向き合う
colorful12
0
200
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
3.6k
残高管理から台帳サービスへの進化
artoy
1
200
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
2
560
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
A Modern Web Designer's Workflow
chriscoyier
699
190k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
KATA
mclloyd
PRO
35
16k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
How STYLIGHT went responsive
nonsquared
100
6.3k
Paper Plane
katiecoart
PRO
5
54k
Ruling the World: When Life Gets Gamed
codingconduct
0
400
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Transcript
Safer Objective-C Błażej Biesiada @_bejo bejo
None
Compile Time Error Checking
Dynamic binding - (void)processArray:(NSArray *)array { for(id object in array)
{ [object process]; } }
“Static” binding - (void)processArray:(NSArray *)array { for(MyObject *object in array)
{ [object process]; } }
Key Paths [object addObserver:self forKeyPath:@"processed" options:0 context:nil];
libextobjc The Extended Objective-C library ! github.com/jspahrsummers/libextobjc
Safer Key Paths [object addObserver:self forKeyPath:@keypath(object.processed) options:0 context:nil];
Selectors [nc addObserver:self selector:@selector(process:) name:@"MyNotification" object:nil];
Safer Selectors [nc addObserver:self selector:@checkselector(self, process:) name:@"MyNotification" object:nil];
Safety first!
Compiler flags - Wall - Wextra - Werror - Wno-unused-parameter
Clang Static Analyzer
Runtime safety
NSNull NSDictionary *dict; dict = @{@"key" : [NSNull null]}; !
id val = dict[@"key"]; [val description];
Safer NSNull NSDictionary *dict; dict = @{@"key" : [EXTNil null]};
! id val = dict[@"key"]; [val description];
Thanks and see you at CocoaHeads Kraków! www.meetup.com/CocoaHeads-Krakow