Skip to content

spm_show_dependencies

Display the complete dependency tree for all Swift Package Manager packages in your project, including transitive dependencies. This shows the hierarchy of which packages depend on which, their resolved versions, and source URLs. Use this to understand your dependency graph, identify duplicate sub-dependencies, or audit what third-party code is included in your project.

ParameterTypeRequiredDefaultDescription
projectPathstringNoAbsolute path to the .xcodeproj, .xcworkspace, or directory containing Package.swift. If omitted, uses the current working directory.

“Show me the full SPM dependency tree”

{
"projectPath": "/Users/johndoe/Projects/MyApp/MyApp.xcodeproj"
}

“What are all the transitive dependencies of my library?”

{
"projectPath": "/Users/johndoe/Projects/MyLibrary"
}
Swift Package Manager Dependencies:
Project: /Users/johndoe/Projects/MyApp/MyApp.xcodeproj
MyApp
├── Alamofire 5.9.1 (https://github.com/Alamofire/Alamofire.git)
├── Kingfisher 8.1.0 (https://github.com/onevcat/Kingfisher.git)
├── SnapKit 5.7.1 (https://github.com/SnapKit/SnapKit.git)
├── swift-composable-architecture 1.17.0 (https://github.com/pointfreeco/swift-composable-architecture.git)
│ ├── combine-schedulers 1.0.2 (https://github.com/pointfreeco/combine-schedulers.git)
│ │ └── xctest-dynamic-overlay 1.4.3 (https://github.com/pointfreeco/xctest-dynamic-overlay.git)
│ ├── swift-case-paths 1.5.6 (https://github.com/pointfreeco/swift-case-paths.git)
│ ├── swift-custom-dump 1.3.3 (https://github.com/pointfreeco/swift-custom-dump.git)
│ │ └── xctest-dynamic-overlay 1.4.3
│ ├── swift-dependencies 1.6.2 (https://github.com/pointfreeco/swift-dependencies.git)
│ │ ├── combine-schedulers 1.0.2
│ │ └── xctest-dynamic-overlay 1.4.3
│ ├── swift-identified-collections 1.1.0 (https://github.com/pointfreeco/swift-identified-collections.git)
│ │ └── swift-collections 1.1.4 (https://github.com/apple/swift-collections.git)
│ └── swiftui-navigation 1.5.4 (https://github.com/pointfreeco/swiftui-navigation.git)
│ └── swift-case-paths 1.5.6
└── swift-collections 1.1.4
Total: 13 packages (6 direct, 7 transitive)
  • spm_resolve — Resolve and fetch all dependencies
  • spm_update — Update dependencies to the latest compatible versions