Xcode lately is rewriting some code source, say empty function on occation is rewritten as {}, etc. It's absolutely infuriating. How to prevent xcode from editing the code behind my back?
CodePudding user response:
This is often a side effect of an automatic code formatting.
Tools like SwiftFormat often get invoked as a build step before compilation to ensure consistent code formatting among all team members.
Another drawback of this method is a lost undo history when a file gets reformatted, but from my experience, pros of autoformatting outweigh the cons even in a one person team.