Is there any way to get the number of classes in a project or the complete workspace in Xcode?
有什么方法可以在Xcode中获取项目或完整工作区中的类数吗?
2 个解决方案
#1
6
You could use cloc which can also be installed via Homebrew: brew install cloc
.
你可以使用cloc,也可以通过Homebrew安装:brew安装cloc。
Cloc is an open source command line tool for counting lines of code, but it also provides the count of files grouped by file type. The simplest form is cloc <path-to-your-project-dir>
but the output can be configured by parameters.
Cloc是一个用于计算代码行的开源命令行工具,但它也提供按文件类型分组的文件的计数。最简单的形式是cloc
A more complex solution (IMHO too complex) is, using Sonarqube with an Objective C plugin. Sonarqube has a nice interface and many functions, but just for counting classes, it's way to much.
一个更复杂的解决方案(IMHO过于复杂)是,使用Sonarqube和一个Objective C插件。Sonarqube有一个很好的接口和许多函数,但是仅仅对于计数类来说,它是非常重要的。
#2
7
A simple way to get a rough idea for a project is by checking the Compile Sources section of the project's Build Phases. The compile sources will list all source files (.m, .swift) and doesn't include any headers.
通过检查项目构建阶段的编译源部分,可以简单地了解项目的大致情况。编译源将列出所有源文件(。并且不包含任何标题。
Assuming roughly one class per source file, this will give you a ballpark idea of how many classes there are in your project at a glance. Note that this doesn't include any embedded projects or frameworks.
假设每个源文件大约有一个类,这将使您粗略地了解项目中有多少类。注意,这并不包括任何嵌入式项目或框架。
#1
6
You could use cloc which can also be installed via Homebrew: brew install cloc
.
你可以使用cloc,也可以通过Homebrew安装:brew安装cloc。
Cloc is an open source command line tool for counting lines of code, but it also provides the count of files grouped by file type. The simplest form is cloc <path-to-your-project-dir>
but the output can be configured by parameters.
Cloc是一个用于计算代码行的开源命令行工具,但它也提供按文件类型分组的文件的计数。最简单的形式是cloc
A more complex solution (IMHO too complex) is, using Sonarqube with an Objective C plugin. Sonarqube has a nice interface and many functions, but just for counting classes, it's way to much.
一个更复杂的解决方案(IMHO过于复杂)是,使用Sonarqube和一个Objective C插件。Sonarqube有一个很好的接口和许多函数,但是仅仅对于计数类来说,它是非常重要的。
#2
7
A simple way to get a rough idea for a project is by checking the Compile Sources section of the project's Build Phases. The compile sources will list all source files (.m, .swift) and doesn't include any headers.
通过检查项目构建阶段的编译源部分,可以简单地了解项目的大致情况。编译源将列出所有源文件(。并且不包含任何标题。
Assuming roughly one class per source file, this will give you a ballpark idea of how many classes there are in your project at a glance. Note that this doesn't include any embedded projects or frameworks.
假设每个源文件大约有一个类,这将使您粗略地了解项目中有多少类。注意,这并不包括任何嵌入式项目或框架。