Airbnb's Swift style guide, with a SwiftPM plugin that formats and lints to it
open sourceMITfree
The Airbnb Swift Style Guide is Airbnb's set of rules for writing Swift, covering naming, formatting, closures, operators, patterns, file organization, SwiftUI, testing and performance, written so most rules can be autocorrected. It ships as a Swift Package Manager command plugin: add the repository as a package dependency and run swift package format to reformat the package with SwiftFormat and check it with SwiftLint using the guide's configuration, or swift package format --lint to only report failures, which exit non-zero for CI. It also has a script for the matching Xcode settings and an AI skill that summarizes the practices autocorrect can't apply.
Problems it solves
- adopt a consistent Swift code style across an iOS team without arguing about it in code review
- autoformat and lint a Swift package with one command in CI
- give a coding agent Swift style rules to follow
Features
- Swift style rules for naming, formatting, patterns, SwiftUI and testing
- swift package format command plugin running SwiftFormat and SwiftLint
- lint-only mode with a non-zero exit code for CI
- script for matching Xcode settings
- AI skill with the practices autocorrect can't apply
Alternatives
The same job
These do what Airbnb Swift Style Guide does.
- SwiftFormat A command-line tool and Xcode extension for formatting Swift code
- Standard Ruby Unconfigurable Ruby linter and formatter built on RuboCop
- Ormolu A formatter for Haskell source code
