Documentation / 01

Getting started

Declare the Swift packages and binary SDKs of each target in a Podfile, then build in Xcode.

Requirements

macOS 13 or later, with Xcode and its command line tools selected for your project. The pinned installer needs Python 3.9 or later. For the optional Fastlane plugin, see its setup guide.

Install with Homebrew

Homebrew SwiftPods tap

Install and update through the SwiftPods-maintained tap.

brew tap swiftpods-org/swiftpods https://github.com/swiftpods-org/swiftpods.git
brew install swiftpods-org/swiftpods/swiftpods

Finding SwiftPods useful? Star on GitHub ↗ Help others discover it.

For CI, pin a release with the installer or GitHub Actions. To build SwiftPods yourself, see Build from source.

Create your Podfile

Place a Podfile next to your Xcode project:

platform :ios, '15.0'

target 'MyApp' do
  spm 'https://github.com/Alamofire/Alamofire.git', '~> 5.9'
  spm 'Networking', path: 'Modules/Networking'

  target 'MyAppTests' do
    spm 'https://github.com/pointfreeco/swift-snapshot-testing.git', exact: '1.18.0',
        products: ['SnapshotTesting']
  end
end

MyAppTests is nested, so it also links what MyApp declares. Check what each target gets before changing the project:

swiftpods check

Install and build

swiftpods install --resolve

Installation adds direct Swift package products, a generated binary container product, a settings file and the Run Script phases [SwiftPods] Prepare and [SwiftPods] Finish to each target of the Podfile. --resolve asks Xcode to resolve versions into Package.resolved. Open the .xcodeproj as usual and build.

What to commit

Commit the Podfile, the Xcode project and MyApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved, which pins the package graph. That workspace lives inside the .xcodeproj; there is no separate .xcworkspace. Add SwiftPods/ to .gitignore: installation recreates it.

When the Podfile names catalog packages, installation also writes SwiftPods.lock, which pins the catalog. Commit it if CI runs deployment mode or a clean checkout must get the same catalog metadata.

Run swiftpods install after pulling a Podfile change; until then [SwiftPods] Prepare stops the build and says so.

Continuous integration

swiftpods install --deployment

Deployment fails unless Package.resolved satisfies every requirement and, for catalog packages, a matching SwiftPods.lock is present. It never creates or updates either file. See locks and deployment.

Next steps