Swift packages and conflicting dependencies

Short answer:

Now it's option 2, fail to build.
It gives an error: swift-build: The dependency graph could not be satisfied

It's because SPM is on very early stage of development, very early beta.
Dependency Resolution

The Swift Package Manager does not currently provide a mechanism for automatically resolving conflicts in a dependency tree. However, this will be provided in the future.

Long answer:

Swift has namespaces. It means that packageC in packageA would have a full name packageA.packageC. And in packageB it would be packageB.packageC

Because of that, it is possible to have the same framework included more than once.
SPM also fetch dependencies with version suffix (packageC-1.0.0). So I think It should be possible to check what version is required in particular package and fetch it.

Also Swift supports Dynamic frameworks. It means that you can have many version of the same framework and they should not conflict with each other.

As I see it in the future it should be possible to have Option 3 (Install packageC for both packages independent) working.

Summary:

  • Now: Option 2 - fail to build.
  • Future: Option 3 - install both versions independently