Xcode 7 - Swift TODO 注释

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32951729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:59:52  来源:igfitidea点击:

Xcode 7 - Swift TODO comments

swiftxcodecommentsxcode7todo

提问by seanu13

Using Xcode 7 and Swift 2.0, I'm trying to use TODO comments like I would in Visual Studio with C#. I've found sites suggesting

使用 Xcode 7 和 Swift 2.0,我试图像在 Visual Studio 中使用 C# 一样使用 TODO 注释。我发现网站建议

// MARK: comment here
// TODO: comment here
// FIXME: comment here

but none of these seem to work. I'm checking the function hierarchy where it looks like the comments should appear afterwards, and it never updates.

但这些似乎都不起作用。我正在检查函数层次结构,它看起来应该在之后出现注释,并且它永远不会更新。

This is what I'm expecting:

这是我所期待的:

A TODO: comment showing up in Xcode's intellisense

待办事项:Xcode 的智能感知中显示的评论

How can I get these comments to show up in Xcode's intellisense?

如何让这些评论显示在 Xcode 的智能感知中?

回答by Rony Rozen

Just pasting your comments code in Xcode 7 with Swift 2.0 seems to work. It looks like this:enter image description here

只需使用 Swift 2.0 在 Xcode 7 中粘贴您的注释代码似乎就可以了。它看起来像这样:在此处输入图片说明

回答by casillas

Adding code annotation to the jump bar

给跳转条添加代码注解

You can add useful information, such as to-dos, bug-fix reminders, and section headings to the jump bar symbol pop-up menu by annotating your code in the source editor.

Add a to-do item: Insert a comment with the prefix TODO:.

For example:

// TODO: [your to-do item].

Add a bug fix reminder: Insert a comment with the prefix FIXME:.

For example:

// FIXME: [your bug fix reminder].

Add a heading: Insert a comment with the prefix MARK:.

For example:

// MARK: [your section heading].

Add a separator line: To add a separator above an annotation, add a hyphen (-) before the comment portion of the annotation.

For example:

// MARK: - [your content]. To add a separator below an annotation, add a hyphen (-) after the comment portion of the annotation.

For example:

// MARK: [your content] -.

通过在源代码编辑器中注释代码,您可以向跳转条符号弹出菜单添加有用的信息,例如待办事项、错误修复提醒和部分标题。

添加待办事项:插入带有前缀 TODO: 的评论。

例如:

// TODO: [你的待办事项]。

添加错误修复提醒:插入带有前缀 FIXME: 的注释。

例如:

// FIXME:[您的错误修复提醒]。

添加标题:插入带有前缀 MARK: 的注释。

例如:

// MARK:[你的部分标题]。

添加分隔线:要在注释上方添加分隔符,请在注释的注释部分前添加连字符 (-)。

例如:

// 标记:- [您的内容]。要在注释下方添加分隔符,请在注释的注释部分后添加连字符 (-)。

例如:

// 标记:[您的内容] -。

https://help.apple.com/xcode/mac/current/#/dev86a148f73

https://help.apple.com/xcode/mac/current/#/dev86a148f73