In Objective-C, is it considered good or bad practice to replace argument types with more specific (subclass) argument types in your implementation of a delegate/protocol method?
For instance, according to the documentation for UIGestureRecognizer:
The action methods invoked must conform to one of the following signatures: - (void)handleGesture; - (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer;
When I add a UITapGestureRecognizer to a view, I know that the argument to handleGesture:
will be of type UITapGestureRecognizer (unless another gesture recognizer is added later). Is it frowned upon to replace the UIGestureRecognizer argument with an argument of type UITapGestureRecognizer? For example:
- (void)handleGesture:(UITapGestureRecognizer *)gestureRecognizer { // implementation }