Safeguard
Developer Tools•

Which file locks versions: SwiftPM, CocoaPods, Carthage or Gradle?

Mobile dependency managers record resolved versions in different files. A comparison of what each tool writes, what to commit, and how to audit it.

Safeguard Security Team
3 min read

CocoaPods locks versions in Podfile.lock and Carthage in Cartfile.resolved, and both tell you to commit them. Swift Package Manager records resolved versions in its own resolved file, and Gradle offers dependency locking as an option you turn on. In every case, commit the file and review its diffs.

Comparison

ToolRules fileResolved recordCommit it?
CocoaPodsPodfilePodfile.lockYes, per the CocoaPods guide
CarthageCartfileCartfile.resolvedYes, per the README
SwiftPMPackage.swiftResolved file generated by the toolYes, as a rule of reproducible builds
GradleBuild scripts and catalogsLock files if dependency locking is enabledYes, once enabled

The first two rows come from the official guidance. For the others, check the current documentation for exact file names and flags in your tool version.

Rules versus results

Every manager has two layers. The rules file says what you will accept, such as a range. The resolved record says what you actually got. Advisories are written against versions, so the resolved record is the file that answers "am I affected".

Audit questions

  1. Is the resolved file committed on every branch you ship from?
  2. Does CI install from it rather than re resolve?
  3. Who reviews changes to it?
  4. Can you produce the version of every dependency in last month's release?
  5. For Gradle, is locking turned on? How to turn it on shows the steps.
  6. Do you have an inventory that spans all managers if your app mixes them?

Mixed projects

Many apps use more than one. An iOS app may have pods and Swift packages. A Kotlin Multiplatform app adds Gradle on top. Each file covers its own world, so combine them into one list or you will miss a layer.

Try it yourself

Click through it at your own pace, or open it full screen. Check how direct and transitive packages come together in one view.

Safeguard builds an SBOM and scans your dependencies for known vulnerabilities, and you can run a free scan at gold.safeguard.sh/scan to see what your own project pulls in.

Quick check

Which is more useful for an advisory, the rules or the resolved file?

The resolved file. It lists the versions you actually use, while the rules file lists what you would accept.

Is Gradle locked by default?

No. Dependency locking is something you turn on. See the linked how to for the steps.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.