SwiftPods

Documentation / 01

Getting started

Manage pods and Swift Package Manager dependencies in the same Podfile, then build your project in Xcode.

Requirements

A Mac with Xcode and its command line tools. Install the SDKs needed by your project. Homebrew installs a compatible Ruby as a separate dependency for Podfiles, podspecs and hooks.

Install with Homebrew

brew install swiftpods

Check the installed version:

swiftpods --version

Create your Podfile

Place a Podfile next to your Xcode project. Declare pods and Swift packages in the same target:

platform :ios, '15.0'

target 'MyApp' do
  use_frameworks! :linkage => :static
  pod 'Networking', :path => './Modules/Networking'

  spm 'swift-collections',
      :git => 'https://github.com/apple/swift-collections.git',
      :from => '1.0.0',
      :products => ['Collections']
end

The local Networking module needs its own podspec. The Collections product comes from Apple's Swift Collections package. See Swift packages for version requirements and product selection.

Install and build

swiftpods install

Open the generated .xcworkspace in Xcode. Xcode resolves the Swift packages as part of its build workflow. Commit Podfile, Podfile.lock and the project's Package.resolved to keep both sets of versions under version control.

Use locked versions in CI

swiftpods install --deployment

Deployment mode rejects changes that would require updating the pod lockfile. Keep Package.resolved in the checkout for Xcode's Swift package resolution. Pin the SwiftPods release and external Ruby version in your runner image.

Pin the installer and release

For a pinned CI setup, use Python 3.9+ and the external Ruby required by the release. Take the version and both checksums from a verified published release. Replace the placeholders below before running the commands:

RELEASE_VERSION='VERSION'
INSTALLER_SHA256='INSTALLER_SHA256'
MANIFEST_SHA256='MANIFEST_SHA256'

curl --fail --location \
  "https://github.com/swiftpods-org/swiftpods-release/releases/download/v${RELEASE_VERSION}/install.py" \
  --output install.py
printf '%s  install.py\n' "$INSTALLER_SHA256" | shasum -a 256 -c -
python3 install.py --version "$RELEASE_VERSION" \
  --manifest-sha256 "$MANIFEST_SHA256" --prefix "$PWD/.build/swiftpods"
export PATH="$PWD/.build/swiftpods/bin:$PATH"
swiftpods install --deployment

Verify the installer checksum before executing it. Pin the external Ruby patch in your runner image for repeatable environments; SWIFTPODS_RUBY selects its absolute executable path.

Update deliberately

brew upgrade swiftpods
swiftpods update Networking

The first command updates SwiftPods. The second updates the selected project dependency and its lockfile.