LinusG.
LinusG.

Reputation: 28912

Xcode code completion custom descriptions

For some methods, Xcode's code completion / suggestion / auto-complete feature displays descriptions:

description shown in code completion

When I create classes, functions, variables, and what not and do provide descriptions, the description does not show up:

description of custom function **not** showing

However, in the quick help menu on the right hand side, and when clicking alt+click, it does:

description in quick menu works

I tried this "solution", but it did not work. Is there any special characters I need to include in the description?

Note

I am currently on Xcode 9 beta 1, but I also experienced this issue in Xcode 8.

Update

Glad to say that it now works for me in Xcode 9 GM.

Upvotes: 5

Views: 909

Answers (2)

Vivek
Vivek

Reputation: 5213

Objective-C

1. Just add description before your method just like example.

@interface VVLabelBold : UILabel
-(void) setDefaultTextColor;

/**Disabled Label, This description will show in auto-complete*/
-(void) setDisabled;

@end

2 Call Method for UILabel

[lblSample setDisabled];

#

Upvotes: 0

Nitish
Nitish

Reputation: 14113

I think the reason might be that there is no space after ///.
Right way should be

/// This is a description

As a matter of fact, if you add documentation for a function as mentioned in screenshot, comments are itself added wherein you can see that space is there after ///. Which is intact the right way to add comments/documentation.
Once you option click on the function calling, description is displayed.
The way Apple displays the description in autocomplete is something it does by itself. You may want to use AppleDoc for this.

enter image description here

Upvotes: 3

Related Questions