github/gitignore · Swift.gitignore

Penjelasan template .gitignore Swift

Menjelaskan mengapa Swift.gitignore mengabaikan xcuserdata, file packaging aplikasi, .build Swift Package Manager, build Carthage, dan hasil fastlane, serta kriteria keputusan untuk CocoaPods dan Package.resolved.

Buka di generator Buka bersama macOS, Xcode, Objective-C

Swift.gitignore ditujukan untuk proyek yang membuat aplikasi iOS dan macOS dengan Xcode atau mengembangkan paket dengan Swift Package Manager. Template ini menangani status per pengguna dan file distribusi Xcode, hasil build alat manajemen dependensi (SwiftPM, Carthage, CocoaPods), dan laporan fastlane.

Template ini memiliki banyak aturan opsional yang dikomentari. Item yang keputusan commit-nya bergantung pada kebijakan tim, seperti Pods/, Packages/, Package.resolved, dan *.xcworkspace, secara default tidak diabaikan dan keputusannya diserahkan kepada Anda.

Penjelasan per aturan

PolaApa yang diabaikan dan mengapa
xcuserdata/Status Xcode per penggunaPengaturan yang berbeda untuk setiap pengembang, seperti pilihan scheme, breakpoint, dan tata letak jendela, disimpan di xcuserdata di dalam .xcodeproj dan .xcworkspace. Jika dibagikan, pengaturan satu sama lain akan terus saling menimpa.
*.hmapHeader mapFile untuk pencarian header yang dibuat Xcode selama build.
*.ipa*.dSYM.zip*.dSYMPackaging aplikasiArsip aplikasi untuk distribusi dan file simbol untuk analisis crash. Dibuat baru setiap build dan ukurannya besar. dSYM diunggah dan disimpan di layanan laporan crash.
timeline.xctimelineplayground.xcworkspacePlaygroundTimeline dan workspace internal yang dibuat Swift Playground saat dijalankan.
.build/Swift Package ManagerFolder tempat swift build menaruh checkout dependensi dan hasil kompilasi. Selalu bisa dibuat ulang.
Carthage/Build/CarthageFramework yang di-build Carthage. Checkout sumber (Carthage/Checkouts) hanya dibiarkan sebagai komentar agar bisa dipilih.
fastlane/report.xmlfastlane/Preview.htmlfastlane/screenshots/**/*.pngfastlane/test_outputfastlaneLaporan eksekusi fastlane dan tangkapan layar. Sesuai komentar template, tangkapan layar disarankan dibuat ulang saat diperlukan.

Hal yang perlu diperhatikan dalam praktik

Template asli

Swift.gitignore13 baris aturan
# 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

Sumber template: github/gitignore/Swift.gitignore @356fd7b (2026-09-11) · CC0-1.0

Template yang sering dipakai bersama

Penjelasan template lainnya