Number of classes in project / workspace

Is there a way to get the number of classes in a project or the total workspace in Xcode?

+3


source to share


2 answers


You can use the cloc , which can also be set via the Homebrew : brew install cloc

.

Cloc is an open source command line tool for counting lines of code, but it also provides a file count, grouped by file type. Simplest form cloc <path-to-your-project-dir>

, but output can be configured with parameters.



A more complex solution (IMHO too complicated) using Sonarqube with the Objective C plugin. Sonarqube has a nice interface and lots of features, but just for class counting, that's a lot.

+6


source


An easy way to get a rough idea for a project is to check the Compile Project Sources section of the Build Phases . Compilation sources will list all source files (.m, .swift) and not include headers.

Assuming roughly one class per source file will give you an idea of ​​how many classes there are in your project at a glance. Note that this does not include built-in projects or frameworks.



enter image description here

+7


source







All Articles