Xcode:查看项目中的所有 TODO

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36518728/
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 08:42:46  来源:igfitidea点击:

Xcode: View all TODO's in project

xcodetodo

提问by Marcus Leon

Is there a way to view allTODOmarks in an Xcode project?

有没有办法查看Xcode 项目中的所有TODO标记?

I'm aware of how to do this in a file through the function drop downbut wasn't sure how to see all in a project.

我知道如何通过功能下拉菜单在文件中执行此操作但不确定如何查看项目中的所有内容。

回答by Cyrille

Instead of marking them as

而不是将它们标记为

//TODO: do something

I like to write them this way:

我喜欢这样写:

#warning TODO do something

That allows seeing them in the issue navigator. On production builds I even go as far as checking the "treat all warnings as errors" compiler setting.

这允许在问题导航器中看到它们。在生产版本中,我什至检查“将所有警告视为错误”编译器设置。

回答by George Andrews

You can add a "Run Script" Build Phase to your Target that will look through your entire project for TODO:|FIXME: marks and flag them as warnings.

您可以向目标添加“运行脚本”构建阶段,该阶段将查看整个项目的 TODO:|FIXME: 标记并将它们标记为警告。

This new Build Phase will then list all TODO marks as warnings in the Issue Navigator whenever you Build your project %+B.

每当您构建项目 %+B 时,这个新的构建阶段都会在问题导航器中列出所有 TODO 标记作为警告。

Here's a link to Ben Dodson's tutorial for doing this with Swift files: https://bendodson.com/weblog/2014/10/02/showing-todo-as-warning-in-swift-xcode-project/

这是 Ben Dodson 使用 Swift 文件执行此操作的教程的链接:https: //bendodson.com/weblog/2014/10/02/showing-todo-as-warning-in-swift-xcode-project/

Here is a screenshot of how it looks with a project I've been working on:

这是我一直在从事的项目的外观截图:

Showing TODO marks as Warnings in the Issue Navigator

在问题导航器中将 TODO 标记显示为警告

回答by mattliu

A straight up text search is how I would do it.

直接的文本搜索是我会做的。

Hit shift+command+F (??F), and search for //TODO:(or however your TODOs are formatted)

按 shift+command+F (??F),然后搜索//TODO:(或者您的 TODO 已格式化)