Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Podspec dependency on a SPM package #5903

Closed
1 task done
fulldecent opened this issue Sep 19, 2016 · 6 comments
Closed
1 task done

Allow Podspec dependency on a SPM package #5903

fulldecent opened this issue Sep 19, 2016 · 6 comments
Labels
t3:discussion These are issues that can be non-issues, and encompass best practices, or plans for the future.

Comments

@fulldecent
Copy link
Contributor

CocoaPods' Podspec file format provides information about a pod and lists dependencies needed to build that pod. Now that Apple, the "upstream vendor", has publicly released Xcode, there is a competing standard for publishing and packaging Swift code, Swift Package Manager.

To promote interoperability, this issue advocates allowing pods to express a dependency on SPM packages.


Dependency

Express such dependencies like this:

s.dependency = :spm => 'https://github.com/apple/example-package-deckofplayingcards.git'

or

s.dependency = :spm => 'https://github.com/apple/example-package-deckofplayingcards.git', version => '2.0.1'

Swift has more expressive ways to define version dependencies. To resolve this issue, I recommend we only implement explicit version dependencies for MVP.


Fetching

CocoaPods will need to integrate these new dependencies into the xcode workspace. The swift command line tool makes this much more simple.

@orta
Copy link
Member

orta commented Sep 19, 2016

IMO, we should make it as easy as possible to convert existing CocoaPods libraries into Apple's Swift PM format and make that the way in which people migrate to the officially sanctioned dependency manager.

Adding support for Swift Packages as a dependency of CocoaPods seems like another place where Apple will reasonably break an existing CocoaPods project because we made it work with last years SwiftPM format.

@neonichu
Copy link
Member

Another issue with this would be that swiftpm packages cannot reasonably partake in the resolver which would be a nightmare once transitive dependencies come into play. For example, what happens when the swiftpm dependency depends on AFNetworking and so does one of the Pods?

I was toying with a similar idea back when Carthage came out and abandoned it because of this. I agree with orta that a better way is providing tooling to make it easy for library maintainers to support multiple or to migrate between different dependency managers.

@neonichu neonichu added the t3:discussion These are issues that can be non-issues, and encompass best practices, or plans for the future. label Sep 19, 2016
@fulldecent
Copy link
Contributor Author

Long term, I think the role of CocoaPods will be pod discovery and anything that touches anything that deals with Objective-C.

So what I am hearing here sounds like:

  1. Use CocoaPods to publish your pod no matter what
  2. If writing Swift, and only depending on other SPM-available things, then publish Package.swift

Then eventually peer pressure from downstream will motivate people to drop/replace Objective-C dependencies.

OK, this makes sense and does not require functional changes from CocoaPods.

Thanks for the discussion!

@fulldecent
Copy link
Contributor Author

Maybe to be polite: in the future when someone runs pod trunk push we can say:

Hi it appears you have a Swift 3.0 project that has no objective-c dependencies, maybe think about supporting SPM, for details see url...

That's something to think about later.

@fabb
Copy link

fabb commented Oct 12, 2016

@orta
Copy link
Member

orta commented Oct 12, 2016

Yeah, this is great, hopefully by WWDC 2017 we can start recommending people support it 馃憤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t3:discussion These are issues that can be non-issues, and encompass best practices, or plans for the future.
Projects
None yet
Development

No branches or pull requests

4 participants