This is a snippet I use to format all the files (recursively from the current folder) for iOS projects
function clang-format-ios {
echo "\Clang-Format all files in current dir except ones in */libs/* folder and names containing *.framework.*\n\n"
find . -name "*.[hm]" ! -path "*/libs/*" ! -path "*.framework*" ! -path "*/Pods/*" -print0 | xargs -0 clang-format -i
echo "\nDONE\n"
}
this assumes you
clang-format
installedzsh
environment (e.g. ohmyzsh
)it is easy to install clang-format on OS X via homebrew
with
brew install clang-format
NOTE: this is the same script I have used in the past with uncrustify
but I have decided to switch to clang.