I expect this is a suggestion for an extension on UIKit for the Swift Interface? If so, unfortunately UIKit is out of scope for our modification. That said, it may be a good suggestion for Feedback Assistant that Apple could include for UIKit, and could also be useful for others using Swift anyway in their own codebase!
As a matter of interest, this might be a cleaner implementation?
extension UIResponder {
func chainedResponder<T: UIResponder>(of responderType: T.Type) -> T? {
return sequence(first: self, next: { $0.next })
.dropFirst() // Drop the first one as it will be self
.first(where: { $0 is T }) as? T
}
}