简体   繁体   中英

Xcode code completion custom descriptions

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

代码完成中显示的描述

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

自定义功能的描述**不**显示

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

快速菜单中的描述有效

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.

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.

在此输入图像描述

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];

#

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM