.gitignore for Swift
13 ignore rules for Swift, ready to copy into your repository.
Apple's Swift programming language
The complete .gitignore for Swift
# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-08-05 01:30:22 UTC
# Technologies: Swift
### Swift ###
xcuserdata/
*.hmap
# iOS app archive
*.ipa
*.dSYM.zip
*.dSYM
Carthage/Build/
timeline.xctimeline
fastlane/report.xml
playground.xcworkspace
.build/
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
What these Swift rules actually ignore
Every pattern below, and why it belongs in your .gitignore.
General
| Pattern | What it ignores |
|---|---|
xcuserdata/ |
# User settings |
*.hmap |
# Obj-C/Swift specific |
*.ipa |
iOS app archive |
*.dSYM.zip |
General |
*.dSYM |
General |
timeline.xctimeline |
# Playgrounds |
playground.xcworkspace |
General |
.build/ |
General |
Carthage/Checkouts
| Pattern | What it ignores |
|---|---|
Carthage/Build/ |
Carthage/Checkouts |
fastlane/report.xml |
Carthage/Checkouts |
fastlane/Preview.html |
Carthage/Checkouts |
fastlane/screenshots/**/*.png |
Carthage/Checkouts |
fastlane/test_output |
Carthage/Checkouts |
How to use this .gitignore for Swift
- Copy the Swift rules above, or download the file directly.
- Create a file named .gitignore at the root of your Git repository and paste the rules into it.
- If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
- Commit the .gitignore so everyone on the team shares the same rules.