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
Safer Objective-C
Search
Błażej Biesiada
January 27, 2014
Programming
0
130
Safer Objective-C
Few tips on how to make your Objective-C code safer at compile time.
Błażej Biesiada
January 27, 2014
Tweet
Share
More Decks by Błażej Biesiada
See All by Błażej Biesiada
Objective-C Runtime Hacking
bejo
1
460
Other Decks in Programming
See All in Programming
高速開発のためのコード整理術
sutetotanuki
1
390
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
Architectural Extensions
denyspoltorak
0
270
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.5k
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
0
900
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
250
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
6
1.9k
CSC307 Lecture 09
javiergs
PRO
1
830
CSC307 Lecture 07
javiergs
PRO
0
550
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
190
Featured
See All Featured
Thoughts on Productivity
jonyablonski
74
5k
The Cult of Friendly URLs
andyhume
79
6.8k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
170
Test your architecture with Archunit
thirion
1
2.1k
Mobile First: as difficult as doing things right
swwweet
225
10k
Site-Speed That Sticks
csswizardry
13
1.1k
Raft: Consensus for Rubyists
vanstee
141
7.3k
The agentic SEO stack - context over prompts
schlessera
0
630
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
New Earth Scene 8
popppiees
1
1.5k
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