Skip to content

Instantly share code, notes, and snippets.

@Sadmansamee
Last active October 24, 2017 21:01
Show Gist options
  • Save Sadmansamee/a35903f8f7aa8a981c5177d9e1b2f8d2 to your computer and use it in GitHub Desktop.
Save Sadmansamee/a35903f8f7aa8a981c5177d9e1b2f8d2 to your computer and use it in GitHub Desktop.
Count lines of code in Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute any following command:
a) Including Pods: find . -name "*.swift" -print0 | xargs -0 wc -l
b) Excluding Pods: find . -path ./Pods -prune -o -name "*.swift" -print0 ! -name "/Pods" | xargs -0 wc -l
c) Swift and Obj-C: find . -type d \( -path ./Pods -o -path ./Vendor \) -prune -o \( -iname \*.m -o -iname \*.mm -o -iname \*.h -o -iname \*.swift \) -print0 | xargs -0 wc -l
Alternative way
# brew install cloc
# cd path/to/project/
# cloc .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment