Is there an Objective-C API that list all classes in their Hierarchy
Is there an Objective-C API that list all classes in their Hierarchy? For example I am interested to know what classes does NSUserDefaults开发者_开发知识库 inherits from. I have already checked the OS X Version 10.5 Delta but it did not give anything away.
Just to explain what I'm after, for example in Java we have javadoc for every single object.Because you mentioned javadoc my answer assumes you're not actually looking for an API / programmatic way of doing this, but, rather, simply documentation.
The documentation for NSUserDefaults is here: https://developer.apple.com/documentation/foundation/nsuserdefaults?language=objc
You can locate this in a couple ways:
- Xcode
- DashDoc
Google isn't actually the easiest way - and coming from the Microsoft world, where simply typing a class name into google will pop up the msdn documentation as the first suggestion, this was a bit unnerving. However, I've found typing the word "documentation" after the class name usually comes up with an apple documentation link... but not always. Sometimes specifically searching apple's docs is the best way for this "manual" approach.
Xcode has a direct link to the documentation - and is more convenient than googling. Look under "Help" > "Documentation and API Reference". From here just paste the class name into the search box.
DashDoc is surprisingly great. You can hook it up to a keyboard shortcut, and get documentation in a heartbeat from anywhere. I'm actually loving it... and I only found it a couple weeks ago. It's available on the AppStore.
Apple documentation has documented classes on,
http://developer.apple.com/library/ios/navigation/index.html
and the one you are looking for is at,
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html
And when you at rat reading it's very first information is about where does this class inherits from.
Happy Coding!
If you're talking in terms of an actual programatic interface, no.
If you're talking in terms of documentation, yes ...
To use your example of NSUserDefaults:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html
The table at the top of that article clearly states the 'Inherits from' and the 'Conforms to'; which indicate that NSUserDefaults inherits and extends NSObject.
精彩评论