Frage

Not sure I'm using the best title for this, but it's the best I can think of. For those of us fairly new to XCode, and who've been overly pampered in Visual Studio, I really really miss the feature where in Visual Studio I could decorate my code elements (properties, functions, classes, whatever) with XML that would show up in intellisense so that when a user is trying to use my class library in their code, they could type the name of one of my methods in their code window, and the dropdown would not only include the parameter info (which XCode does), but it would also include whatever other supplementary information I've decorated the method with in order to convey summary descriptions, or additional details, that may not be apparent from the method/property/delegate/etc name alone.

Is this even possible in XCode? I'm assuming not, as I've yet to see it done.

War es hilfreich?

Lösung

You can do it in Xcode.

In the line before your class name/method declaration/property declaration, and always in your header (.h) file, you should include a documentation comment (with /// comment or /** comment **/). This text will be visible in the Xcode drop down menu whenever you type the name of that object/method/property.

Example:

/// This string contains a certain text.
@property (nonatomic, strong) NSString *string;

or

/** This object subclasses UIView to achieve something. **/
@interface MyView : UIView {
...

Andere Tipps

As of Xcode 5 you can document your methods and Xcode will read that documentation the same way it reads Apple's own.

Example...

/**
 *  Does foo things with bar stuff.
 *
 *  @param bar stuff.
 */
- (void)foo:(id)bar;

Results in...

enter image description here

enter image description here

I would also recommend the Xcode Plugin called VVDocumenter to make documenting your methods faster.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top