What's the most robust and readable way of ensuring objects conform to a interface/protocol in Objective C?-Collection of common programming errors
As long as you don’t use plain id as the type, the compiler will at least warn you if you make a mistake at compile time. So you should be fine with your code example #1.
Of course, sometimes you might be forced to work with an id object that you get from a subsystem that is not under your control. In such cases you can cast the object back to the type you think it has (e.g. id ), but you are usually better off if you perform a runtime check first. Better be safe than sorry…
On a final note: If your protocol has optional parts (declared with the @optional keyword), then for those parts you will obviously be able to do runtime checks only. The @required keyword mentioned by apurv is necessary only if you want to be explicit in your protocol declaration (a protocol’s parts are required by default), or if you mix optional and required parts.