github/gitignore · Swift.gitignore
Swift .gitignore 템플릿 해설
Swift.gitignore가 xcuserdata, 앱 패키징 파일, Swift Package Manager의 .build, Carthage 빌드, fastlane 산출물을 무시하는 이유와 CocoaPods·Package.resolved 판단 기준을 설명합니다.
Swift.gitignore는 Xcode로 iOS·macOS 앱을 만들거나 Swift Package Manager로 패키지를 개발하는 프로젝트를 대상으로 한다. Xcode의 사용자별 상태와 배포 파일, 의존성 관리 도구(SwiftPM·Carthage·CocoaPods)의 빌드 결과, fastlane 보고서를 다룬다.
템플릿에는 주석 처리된 선택 규칙이 많다. Pods/, Packages/, Package.resolved, *.xcworkspace처럼 팀의 방침에 따라 커밋 여부가 갈리는 항목은 기본으로 무시하지 않고 판단을 맡긴다.
규칙별 해설
| 패턴 | 무엇을, 왜 무시하나 |
|---|---|
xcuserdata/ | 사용자별 Xcode 상태스킴 선택, 중단점, 창 배치처럼 개발자마다 다른 설정이 .xcodeproj·.xcworkspace 안의 xcuserdata에 저장된다. 공유하면 서로의 설정을 계속 덮어쓴다. |
*.hmap | 헤더 맵Xcode가 빌드 중에 만드는 헤더 검색용 파일이다. |
*.ipa*.dSYM.zip*.dSYM | 앱 패키징배포용 앱 아카이브와 크래시 분석용 심볼 파일이다. 빌드마다 새로 만들어지고 용량이 크다. dSYM은 크래시 리포트 서비스에 업로드해 보관한다. |
timeline.xctimelineplayground.xcworkspace | PlaygroundSwift Playground가 실행하며 만드는 타임라인과 내부 워크스페이스다. |
.build/ | Swift Package Managerswift build가 의존성 체크아웃과 컴파일 결과를 넣는 폴더다. 언제든 다시 만들어진다. |
Carthage/Build/ | CarthageCarthage가 빌드한 프레임워크다. 소스 체크아웃(Carthage/Checkouts)은 주석으로만 남겨 선택하게 했다. |
fastlane/report.xmlfastlane/Preview.htmlfastlane/screenshots/**/*.pngfastlane/test_output | fastlanefastlane 실행 보고서와 스크린샷이다. 템플릿 주석대로 스크린샷은 필요할 때 다시 생성하는 것이 권장된다. |
실무에서 주의할 점
- CocoaPods의
Pods/는 무시하지 않는 것이 템플릿의 기본값이다. 커밋하면pod install없이 빌드되지만 저장소가 커진다. 어느 쪽이든Podfile.lock은 커밋한다. - 앱이라면
Package.resolved를 커밋해 모두가 같은 의존성 버전으로 빌드하게 하는 편이 일반적이다. - macOS에서 작업하므로 macOS 템플릿(또는 Xcode 템플릿)을 함께 선택해
.DS_Store를 막는다.
원본 템플릿
Swift.gitignore
# Xcode## gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore## User settingsxcuserdata/## Obj-C/Swift specific*.hmap## App packaging*.ipa*.dSYM.zip*.dSYM## Playgroundstimeline.xctimelineplayground.xcworkspace# Swift Package Manager## Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.# Packages/# Package.pins# Package.resolved# *.xcodeproj## Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata# hence it is not needed unless you have added a package configuration file to your project# .swiftpm.build/# CocoaPods## We recommend against adding the Pods directory to your .gitignore. However# you should judge for yourself, the pros and cons are mentioned at:# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control## Pods/## Add this line if you want to avoid checking in source code from the Xcode workspace# *.xcworkspace# Carthage## Add this line if you want to avoid checking in source code from Carthage dependencies.# Carthage/CheckoutsCarthage/Build/# fastlane## It is recommended to not store the screenshots in the git repo.# Instead, use fastlane to re-generate the screenshots whenever they are needed.# For more information about the recommended setup visit:# https://docs.fastlane.tools/best-practices/source-control/#source-controlfastlane/report.xmlfastlane/Preview.htmlfastlane/screenshots/**/*.pngfastlane/test_output
템플릿 출처: github/gitignore/Swift.gitignore @356fd7b (2026-09-11) · CC0-1.0