SoFunction
Updated on 2025-04-03

iOS statistics project total number of code lines

If you want to count the ios development code, including the header file, CD into the project directory, the command is as follows

① List the number of lines of each file

Copy the codeThe code is as follows:

find . -name "*.m" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs wc -l

② List the sum of the number of lines of code

Copy the codeThe code is as follows:

find . -name "*.m" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs grep -v "^$"|wc -l

grep -v "^$" is to remove empty lines
•Annotations are also counted within the code quantity, after all, they are also coded one word at a time.

The above is the entire content of this article, I hope you like it.