Sometimes you can be interested in how many lines of code are in your Xcode project files.

There are several ways to figure out the quantity of lines. here we provide the simple one.

To count lines in Xcode project:

  • Open terminal on your mac
  • Type cd in terminal to navigate to your Xcode project directory
  • Inside your project in terminal type this to find only .swift files: find . -name “*.swift” -print0 | xargs -0 wc -l
  • You will get the results with the nubmer of lines in terminal and with the total number of lines related to your project files at the bottom

count lines in xcode

P.S. If you want to exclude pods from the search results, type this in terminal while being in your Project directory:

find . -path ./Pods -prune -o -name “*.swift” -print0 ! -name “/Pods” | xargs -0 wc -l