Xcode代码完成自定义描述

问题描述 投票:3回答:2

对于某些方法,Xcode的代码完成/建议/自动完成功能显示说明:

description shown in code completion

当我创建类,函数,变量以及不提供描述的内容时,描述不会显示:

description of custom function **not** showing

但是,在右侧的快速帮助菜单中,以及单击alt+click时,它会:

description in quick menu works

我试过this "solution",但它没有用。我需要在描述中包含任何特殊字符吗?

Note

我目前正在使用Xcode 9 beta 1,但我也在Xcode 8中遇到过这个问题。

Update

很高兴地说它现在适用于Xcode 9 GM。

ios xcode xcode9
2个回答
2
投票

我认为原因可能是///之后没有空格。 正确的方法应该是

/// This is a description

事实上,如果您为屏幕截图中提到的功能添加文档,则会添加注释,其中您可以在///后看到空格。这是添加评论/文档的正确方法。 选择单击函数调用后,将显示说明。 Apple在自动完成中显示描述的方式本身就是这样做的。您可能想要使用AppleDoc

enter image description here


0
投票

Objective-C的

1.只需在方法之前添加描述,就像示例一样。

@interface VVLabelBold : UILabel
-(void) setDefaultTextColor;

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

@end

2 UILabel的呼叫方法

[lblSample setDisabled];

#

© www.soinside.com 2019 - 2024. All rights reserved.