Here’s yet another handy piece from the oft-mentioned Erica Sadun: convenience methods for NSObject which now include an elegant way to account for differing SDK interfaces at runtime.
… I’ve put together a category of NSObject utility methods here:
http://github.com/erica/NSObject-Utility-Categories/tree
This code basically derives from stuff I’ve needed for other projects at various times. The latest addition is a selector check that returns the first one an object responds to, e.g.
SEL aSelector = [object chooseSelector: sel31version, sel30version, sel22version];This offers run-time selector selection based on the current firmware. To use the selector, I’ve added a plethora of performSelector choices…
Handier than figuring it out yourself!
h/t: iPhoneSDK!

0 Responses to “Snippet: Selector choosing”
Leave a Reply