This document covers gitignore patterns for iOS and macOS development using Swift and Objective-C languages. These templates handle language-specific build artifacts, app packaging outputs, dependency management systems (CocoaPods, Carthage, Swift Package Manager), and Apple platform development tools.
For Xcode IDE-specific patterns including workspace configurations and project metadata, see Xcode for Apple Development. For cross-platform mobile development using Flutter, see Flutter and Dart.
The repository provides three distinct but coordinated templates for Apple platform development, each serving a specific purpose in the template hierarchy:
| Template File | Location | Purpose |
|---|---|---|
Xcode.gitignore | Global/ | IDE-level patterns shared across all Xcode projects |
Objective-C.gitignore | Root | Language-specific patterns for Objective-C projects |
Swift.gitignore | Root | Language-specific patterns for Swift projects |
All three templates include synchronized comments indicating they should be updated together: "gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore" Objective-C.gitignore3 Swift.gitignore3
Sources: Global/Xcode.gitignore1-3 Objective-C.gitignore1-45 Swift.gitignore1-63
Both Swift and Objective-C templates share common patterns for Xcode user settings, build outputs, and app packaging artifacts.
The xcuserdata/ directory contains user-specific IDE settings that should never be committed, as they include personal preferences, breakpoints, and scheme configurations that vary per developer Objective-C.gitignore6 Swift.gitignore6 Global/Xcode.gitignore2
Sources: Objective-C.gitignore8-14 Swift.gitignore8-14
| Pattern | Description | Reason for Exclusion |
|---|---|---|
*.hmap | Header map files generated during compilation | Build-time artifacts, regenerated automatically |
*.ipa | iOS App Store Package files | Binary distribution artifacts, not source code |
*.dSYM | Debug symbol directories | Large binary debugging data, stored separately |
*.dSYM.zip | Compressed debug symbols | Archive artifacts for crash reporting services |
Sources: Objective-C.gitignore9-14 Swift.gitignore9-14
Swift projects generate additional artifacts not present in Objective-C development:
Xcode Playgrounds create workspace and timeline files that are user-specific or regenerated:
timeline.xctimeline Swift.gitignore17playground.xcworkspace Swift.gitignore18The .build/ directory contains Swift Package Manager compilation outputs, dependency checkouts, and intermediate build products Swift.gitignore32 This is always excluded regardless of dependency management strategy.
Sources: Swift.gitignore16-32
Both languages share identical patterns for:
xcuserdata/ Objective-C.gitignore6 Swift.gitignore6*.hmap Objective-C.gitignore9 Swift.gitignore9*.ipa, *.dSYM, *.dSYM.zip Objective-C.gitignore12-14 Swift.gitignore12-14Sources: Objective-C.gitignore5-14 Swift.gitignore5-14
Apple platform development supports multiple dependency management approaches, each with distinct ignore patterns and repository strategies.
Sources: Objective-C.gitignore16-32 Swift.gitignore20-50
CocoaPods is a centralized dependency manager that generates workspace files and downloads dependencies to a Pods/ directory.
Commented Patterns (User Decision Required):
# Pods/ Objective-C.gitignore22 Swift.gitignore40# *.xcworkspace Objective-C.gitignore25 Swift.gitignore43The templates include extensive comments explaining the tradeoffs:
"We recommend against adding the Pods directory to your .gitignore. However you should judge for yourself..." Objective-C.gitignore18-20 Swift.gitignore36-38
Carthage is a decentralized dependency manager that builds frameworks.
Always Ignored:
Carthage/Build/ Objective-C.gitignore32 Swift.gitignore50Commented Pattern:
# Carthage/Checkouts Objective-C.gitignore30 Swift.gitignore48Sources: Objective-C.gitignore27-32 Swift.gitignore45-50
Swift Package Manager (SPM) is integrated directly into Xcode.
Always Ignored:
.build/ Swift.gitignore32Commented Patterns:
# Packages/ Swift.gitignore23# Package.pins Swift.gitignore24# Package.resolved Swift.gitignore25# *.xcodeproj Swift.gitignore26# .swiftpm Swift.gitignore30The template explains that Xcode automatically generates the .swiftpm directory with workspace data and user data, making it unnecessary to track unless specific package configuration files are added Swift.gitignore28-30
Sources: Swift.gitignore20-32
Both templates include identical fastlane patterns for automated workflows.
| Pattern | Description | Reason for Exclusion |
|---|---|---|
fastlane/report.xml | Test execution and build summary | Generated on each run Objective-C.gitignore41 |
fastlane/Preview.html | HTML preview of app metadata | Generated from configuration Objective-C.gitignore42 |
fastlane/screenshots/**/*.png | Automated screenshot captures | Regenerated via fastlane snapshot Objective-C.gitignore43 |
fastlane/test_output | Test results and logs | Generated during execution Objective-C.gitignore44 |
The templates recommend against storing screenshots in the repository, suggesting they be re-generated whenever needed Objective-C.gitignore36-39 Swift.gitignore54-57
Sources: Objective-C.gitignore34-44 Swift.gitignore52-62
Projects using both Swift and Objective-C should combine both templates. Since both files share identical patterns for common artifacts (header maps, IPA files, debug symbols, CocoaPods, Carthage, fastlane), there are no conflicting rules. The additional patterns from combining templates primarily involve Swift-specific features:
timeline.xctimeline, playground.xcworkspace) Swift.gitignore17-18.build/, commented SPM patterns) Swift.gitignore20-32Sources: Objective-C.gitignore1-45 Swift.gitignore1-63
The three Apple platform templates maintain explicit synchronization comments to ensure consistency. When contributing updates, all three files should be reviewed together:
Global/Xcode.gitignore - IDE-level patterns Global/Xcode.gitignore1-3Objective-C.gitignore - Language specifics Objective-C.gitignore1-45Swift.gitignore - Language and SPM specifics Swift.gitignore1-63This synchronization requirement is explicitly documented in both language templates Objective-C.gitignore3 Swift.gitignore3 to prevent divergence in shared pattern coverage.
Refresh this wiki