.gitignore for Swift + Xcode
Complete .gitignore for iOS/macOS Swift apps developed in Xcode.
Quick presets
Selected (2)
SwiftXcode
Your selections never leave your browser. Generation happens entirely client-side.
27 patterns · 520 B
# Generated by DevZone Tools — https://devzone.tools/tools/gitignore-generator # Templates: Xcode, Swift # 2026-04-20 # ---- Xcode ---- # Xcode build/ DerivedData/ *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata/ *.moved-aside *.xccheckout *.xcscmblueprint *.hmap *.ipa *.dSYM.zip *.dSYM timeline.xctimeline playground.xcworkspace .build/ # ---- Swift ---- # Swift .DS_Store /.build /Packages /Package.resolved /*.xcodeproj .swiftpm
Why use Swift + Xcode together?
Swift iOS and macOS development centers on Xcode. The Swift template covers SPM build artifacts (.build/, Package.resolved, .swiftpm/). The Xcode template covers DerivedData (the large build cache), xcuserdata (personal breakpoints and schemes), and generated project files.
DerivedData is the most important Xcode ignore — it can grow to many gigabytes and is entirely regenerated by Xcode.
Related combinations
Frequently asked questions
- Do I need to commit .gitignore?
- Yes — .gitignore should be committed to the repository so all collaborators benefit from the same ignore rules.
- How do I add custom patterns?
- Open your .gitignore file and add the pattern on a new line. Use # for comments, * for wildcards, / to match directories, and ! to un-ignore a previously ignored path.
- How do I ignore a file that is already tracked?
- Adding a file to .gitignore does not remove it from tracking if it was previously committed. Run: git rm --cached <file> to stop tracking it without deleting the file locally.
- Why combine Swift and Xcode?
- Swift iOS and macOS development centers on Xcode. The Swift template covers SPM build artifacts (.build/, Package.resolved, .swiftpm/). The Xcode template covers DerivedData (the large build cache), xcuserdata (personal breakpoints and schemes), and generated project files.
Looking for something else? Browse all templates →