Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).
xcodeproj gem). Under no circumstances may you write or execute
Ruby scripts..swift) or resource files, simply write them to the correct directory on
disk. They will be automatically included in the Xcode project. Never manually
modify the .pbxproj file to add files.xcode_spm_setup
script does), you must use Swift. Only as an absolute last resort, if Swift
is completely unviable, may you use Node.js or TypeScript.swift --version before proceeding.xcode-select --install on macOS), or
ask if you can attempt to install it for them. Do not attempt to proceed
without Swift.+load methods (such as the Firebase iOS SDK suite), the Apple
linker will aggressively strip these methods out if they are linked statically.FirebaseAuth/Auth.swift:167: Fatal error: Unexpectedly found nil).xcode_spm_setup Swift script automatically injects the -ObjC
flag to OTHER_LDFLAGS when adding Firebase products. However, you should
still verify it is present in the build settings if you encounter issues..xcodeproj or .xcworkspace exists, you MUST ask the user to create the
project first:.xcodeproj via Xcode, then
proceed with the Standard Xcode Workflow below.sed, or Ruby scripts to modify .pbxproj files
directly.scripts/xcode_spm_setup) to securely install SPM packages and link optional
config files (like GoogleService-Info.plist).11.x.y) in your commands instead
of hardcoded placeholders.MyApp), navigating to General > Frameworks,
Libraries, and Embedded Content, and hitting the + button to explicitly
link the specific product modules (e.g., Alamofire).xcode_spm_setup Swift script automatically handles BOTH of
these steps for you. By passing the list of modules as arguments, it safely
injects the package dependency and automatically wires those modules to the main
target's Frameworks build phase. You do not need to do any manual linking.scripts/xcode_spm_setup directory on disk.swift run command using the signature below:swift run --package-path <PATH_TO_SKILL>/scripts/xcode_spm_setup xcode_spm_setup <ProjectPath.xcodeproj> <RepoURL> <VersionRequirement> [--plist <Optional/Path/To/Config.plist>] <Product1> [Product2 ...]
--plist flag.swift run --package-path /Users/foo/.agents/skills/xcode-project-setup/scripts/xcode_spm_setup xcode_spm_setup MyApp.xcodeproj https://github.com/Alamofire/Alamofire 5.8.1 Alamofire
GoogleService-Info.plist to the resources
build phase automatically. Note: Replace 11.0.0 with the actual latest
version from
the releases page.swift run --package-path /Users/foo/.agents/skills/xcode-project-setup/scripts/xcode_spm_setup xcode_spm_setup MyApp.xcodeproj https://github.com/firebase/firebase-ios-sdk 11.0.0 --plist MyApp/GoogleService-Info.plist FirebaseCore FirebaseAuth FirebaseFirestore