SwiftPM/Xcode too aggressive in fetching unneeded dependencies?

I'm using SPM in my Xcode project to manage some dependencies, and I've come across a situation where I think it's fetching more dependencies than it needs. I don't know if it's SPM or Xcode doing that, though.

The SwiftPhoenixClient Package.swift has three products, three targets, and two external dependencies. As I read the manifest, the StarscreamSwiftPhoenixClient product/target only needs Starscream, and does not need RxSwift. But Xcode pulls those RxSwift when I add StarscreamSwiftPhoenixClient to my project.

Is that how it's supposed to work? As far as I can tell, it’s not actually including RxSwift in the application binary, but it still seems like wasted work.

1 Like

I think I read somewhere on this forum that SwiftPM dependency algorithm improvements were going to be part of Swift 5.4 but were reverted last minute due to some bugs. But yeah right now it pulls in more than it needs to.

1 Like