Why does AppDelegate inherit from UIResponder? Why does AppDelegate inherit from UIResponder? ios ios

Why does AppDelegate inherit from UIResponder?


From Converting to Storyboards Release Notes:

Note: In the current Xcode templates, the application delegate class inherits from UIResponder. This is so that the delegate instance can participate in the responder chain and so handle application-level actions. If you haven’t made use of this pattern in an existing application, there’s no need to adopt it for storyboards.


Check the documentation of UIResponder. Since AppDelegate can respond to touch events, it implements the UIResponder interface.


UIResponder is the base class for the UIKit framework. UIResponder can deal with the events.

Your AppDelegate class is the delegate class for the UIApplication which UIApplicationMain creates. AppDelegate conforms to the UIApplicationDelegate protocol.

The UIResponder class has the methods to get the window of the application focus on which all the views will be populated, so you should have a class that inherits from UIResponder in order to make the window as key.