Search code examples
objective-cxcodecode-metrics

Number of classes in project/workspace


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


Solution

  • You could use cloc which can also be installed via Homebrew: brew install 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.

    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.