Swift Code Linting and Formatting Best Practices
Article Summary
Cecília Saraiva from Glovo reveals how their 30+ iOS engineers maintain code consistency without the manual overhead. Spoiler: automation is doing the heavy lifting.
When you've got dozens of engineers contributing to the same codebase, code style chaos is inevitable. Glovo's iOS team tackled this by implementing automated linting and formatting tools that enforce standards without slowing developers down.
Key Takeaways
- SwiftLint runs autocorrect pre-action and lint during build phase in Xcode
- SwiftFormat executes as git pre-commit hook to fix code automatically
- Linters report violations; formatters actually fix the code for you
- All rules agreed upon by iOS community and documented in guidelines
Glovo automated code style enforcement across 30+ iOS engineers using SwiftLint in Xcode and SwiftFormat as a pre-commit hook, letting developers focus on building instead of formatting.
About This Article
Glovo's iOS team struggled to keep code style consistent across their codebase while following industry standards and internal guidelines. Enforcing this manually created too much overhead.
They set up SwiftLint to catch style issues during the Xcode build process. SwiftFormat runs as a git pre-commit hook to automatically fix violations before code gets committed.
Engineers spend less time on code formatting and more time building features. All the rules are documented in one place and agreed on by the team.