4

I have a podspec, that depends on another library. That library doesn't have a spec published.

What would be the best way to resolve the dependency in this case? The "dependency" keyword only allows referencing other specs, but not a repo outside (e.g. via a repo + SHA-1)

Publish a spec for the library myself? Or can I create a local podspec that I commit with the repo and reference that somehow?

camimvogelsang
  • 289
  • 1
  • 4
  • 10

1 Answers1

2

You'd be best off creating a spec for the other library and including that spec as a dependency in yours. The other option would be to bundle the library with yours and reference the files in your spec locally. That is not recommended.

Keith Smiley
  • 61,481
  • 12
  • 97
  • 110
  • So you suggest publishing a public podspec and push on Cocoapods/Specs? What would happen in the case that the library maintainer one day decides he wants to publish a spec himself? Would that produce a duplicate then? Also I would prefer to not have another podspec that others rely on and I would have to maintain (just want to reference it "internally"). Is there a way to do "auto git submodule init & update on pod update" maybe? Then I could fall back to using git submodules for those dependencies. – camimvogelsang May 31 '14 at 05:37
  • You could fall back to submodules. If the original maintainer ever wanted to take it over they could be granted access through trunk. You could also make a private specs repo with this spec for only your internal use. – Keith Smiley May 31 '14 at 06:17
  • Hey Keith, thanks a lot for your help, appreciated it! To clarify, falling back to git submodules would mean to add it in the instructions right? Something like "add pod to your Podfile, after pod update, call git submodule init..." or is there a way to get it automated so that a "pod update" would also do a "git submodule init" for the user? – camimvogelsang May 31 '14 at 09:59
  • 1
    Also regarding "private podspec", is there a way to reference that as a dependency in the main podspec? Or does the user have to add the custom Specs repo first ("pod repo add"). – camimvogelsang May 31 '14 at 11:31
  • You can actually set your source to automatically download submodules. Documentation [here](http://guides.cocoapods.org/syntax/podspec.html#source). That way the user wouldn't have to deal with or know about how that. You wouldn't want to publicly publish a spec that relied on a private dependency. The spec would not pass `pod spec lint` and it wouldn't work for anyone but you. – Keith Smiley Jun 01 '14 at 04:58