Re: Understanding the docs. UIApplication for iOS
Re: Understanding the docs. UIApplication for iOS
- Subject: Re: Understanding the docs. UIApplication for iOS
- From: Alex Zavatone <email@hidden>
- Date: Mon, 03 Jun 2013 16:22:24 -0400
On Jun 3, 2013, at 3:19 PM, Bill Garrison wrote:
>
> On Jun 3, 2013, at 1:49 PM, Alex Zavatone <email@hidden> wrote:
>
>> What I'm used to in Apple's iOS class reference docs are listings at the top of the file that specify the objects inherited from and protocols conformed to.
>>
>> I'm either missing something with UIApplication, or the docs are.
>>
>> Referring to this class reference document:
>> https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html
>>
>> It's not listed that the UIApplication class conforms to the UIApplicationDelegate, but it is mentioned that the delegate exists and is "defined" by the UIApplication.
>>
>> In fact, in the .h file, it obviously extends UIResponder to conform to the UIApplicationDelegate, but you actually can't tell this by eyeballing the docs. It's not listed at all until you read the overview.
>>
>> Shouldn't this be included in the "Conforms to" section at the top of the class reference, while stating that it is conformed to through an extension to UIResponder?
>>
>> It just seems odd that a fundamental part of UIApplication (the delegate protocol) isn't mentioned in area of the doc that normally lists it.
>>
>> If this is a doc bug, I'll gladly report it, but I'd like to make sure it's not my oversight first.
>>
>> Thoughts?
>
> Alex,
>
> Not a doc bug.
>
> UIApplication doesn't conform to UIApplicationDelegate. The shared instance of UIApplication, though, is the grand poobah object that ensures that UIApplicationDelegate methods get invoked and that all application lifecycle notifications get posted at the appropriate times.
>
> You *could* write a working iOS application without implementing any UIApplicationDelegate compliant class. Subclass UIApplication and have it do the things that an app delegate would do by writing handlers for all the application notifications that get broadcast. This would be a great learning exercise, and you would come to fully appreciate the value of the UIApplicationDelegate object.
>
> The docs are correct, though. UIApplication doesn't implement any of the UIApplicationDelegate defined methods, so it doesn't conform to the protocol.
>
> Bill
Thanks for that concise explanation. It does seem that the auto generated code for the AppDelegate is doing the extension of UIResponder. Here is the @interface code from my Xcode 4.6.1 iOS app's AppDelegate:
@interface AppDelegate : UIResponder <UIApplicationDelegate>
But looking at the header file that Jens pointed out, I see it in the @package and in the +sharedApplication instance as you mentioned. And at that point, my knowledge of the subject falls short.
I guess I used the wrong term in asking about this, as it seems more like a doc shortcoming than a bug.
Yeah, the AppDelegate doesn't conform at all to the Delegate by itself, agreed.
But, if the standard is to create an AppDelegate.h that does so,when creating an iOS app project in Xcode, shouldn't that be up in the UIApplication Class Reference? An explanation with a stipulation stating: "I conform to the UIApplicationDelegate by extending the UIResponder in the auto generated AppDelegate.h"? Or at least something more elegantly worded?
In any case, I know about it now, but since the docs are supposed to make these relations clear and this is a standard, it seems like they are falling short a little in this case.
Just making sure how to properly predict and interpret the docs can take some doing, especially in this case, and this case is present every time you create a new iOS app in Xcode.
Cheers, and thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden