How do I provide a default implementation for an Objective-C protocol?
问题 I'd like to specify an Objective-C protocol with an optional routine. When the routine is not implemented by a class conforming to the protocol I'd like to use a default implementation in its place. Is there a place in the protocol itself where I can define this default implementation? If not, what is the best practice to reduce copying and pasting this default implementation all over the place? 回答1: Objective-C protocols have no affordance for default implementations. They are purely