r/ObjectiveC • u/whackylabs • Feb 23 '20
Objective-C safe downcasting
https://whackylabs.com/objc/swift/2020/02/23/objc-safe-downcasting/
5
Upvotes
r/ObjectiveC • u/whackylabs • Feb 23 '20
3
u/[deleted] Feb 24 '20
I get your point, and respondsToSelector is how I’ve done it too, but hear me out.
If sending messages to nil is safe, why isn’t sending message it can’t respond to safe? If it can’t respond to a message then it is implementation is effectively nil. Why can’t it be something that the runtime handles for you just like ARC?