Created
February 16, 2016 19:08
-
-
Save fe9lix/94ac697203b8c823209d to your computer and use it in GitHub Desktop.
Xcode: Remove header comments in Swift files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -name "*.swift" -not -path "./Pods/*" -exec sed -i '' -e '1,/^import/{/^\/\/.*/d;}' -e '/./,$!d' {} \; |
Did you find a solution for this?
Amazing!
👍
Here is my version of script with fixed problem from comments above
find . -type f -name "*.swift" -not -path "./Pods/*" -exec sh -c '
if ! head -n 1 "$1" | grep -q "^[A-Za-z]"; then
sed -i "" -e "1,/^[A-Za-z]/{
/^\/\/.*/d;
/^$/d;
}" "$1"
fi
' sh {} \;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It also removes my pragma mark outside my class implementation, such as:
// MARK: UITableViewDelegate
Is there any way I could make it keep them?
Thanks