Adding cocoapods-art plugin to podspec for private repo dependency - cocoapods

I've been using a private cocoapod library in my app which is installed via cocoapods-art. Now I have created a wrapper for this library and want to make our own cocoapod for it so we can use it into multiple other applications. But I don't know if it's possible to use a cocoapods-art plugin in the podspec file
I couldn't find an example on how to add a cocoapods-art lib as a dependency in the podspec file. The way it's installed in my Podfile:
plugin 'cocoapods-art', :sources => [
'PRIVATE_REPO'
]
source 'https://github.com/CocoaPods/Specs.git

Related

source issue with podfile

I'd like to specify version 5.1.0 of the InstaCart TrueTime library in a Podfile instead of 5.0.3. I think this is the only way to use 5.1.0 since 5.0.3 hasn't been added to the master per https://github.com/instacart/TrueTime.swift/issues/97
(The library is pretty outdated unfortunately.)
According to Add Pod dependency with source to .podspec, the way to do this is add
source 'https://github.com/instacart/TrueTime.swift.git'
at the top, but I then get the following error with 'pod update':
[!] Unable to find a specification for `TrueTime`
I think this error occurs because the source has TrueTime.podspec at the top level instead of inside a '5.1.0' folder, even though my podspec doesn't specify a version:
s.dependency "TrueTime"
Is my thinking correct, and is there a way to solve this issue?
The source attribute is used to refer to a podspec repository, not a single pod.
To accomplish that goal, you could set up a private specs repository and publish the desired podspec there - then refer to the podspec repo from the Podfile.
Details at https://guides.cocoapods.org/making/private-cocoapods.html

Podspec. Set s.dependency to download forked repo sources

I have a repo that I download via cocoa pods. This repo includes .podspec file which include s.dependency 'glm', '~> 0.9.4.6' line.
as I understood it will download it from here: https://github.com/g-truc/glm
I forked glm and now I want to use s.dependency that is connected to forked repo of glm. How can I specify it in podspec file to point that I need to download forked glm sources?
You can have CocoaPods override a location of a dependency's dependency in your Podfile, i.e. defining pod 'glm', :git => 'https://github.com/yourUser/yourFork.git'
You have to make sure the line where you specify your fork comes before the line that specifies the pod that uses it as a dependency.
See this answer about this topic, and this one about using forks with CocoaPods conveniently.

How do I make a new header file of my own library visible in a CocoaPods-based project?

I use CocoaPods for developing an app that also uses a private library "MyLib" I develop in parallel to the app. MyLib maintains its own podspec and is referenced in the app's podfile like so:
pod 'MyLib', :path => '~/Projects/iOS/Own/Frameworks/mylib'
I noticed that CocoaPods maintains its own public header file directory for MyLib at /pods/Headers/Public/MyLib and includes that directory in compiling source files from the app.
My question: what makes CocoaPods update this header files directory if I add a new public category to MyLib.xcodeproj that I want to use in the app?
Thanks in advance.
pod install or pod update need to be executed whenever your add a new file to your pod doesn't matter if it is public header or private implementation file. Old files can be changed without updating

Build xcconfig from podspec using exact version of dependency

The ParcelKit Cocoapods podspec file defines a dependency on the Dropbox Sync API SDK like so:
s.dependency 'Dropbox-Sync-API-SDK', '~> 3.1.0'
At the moment, this means it fetches version 3.1.1 of the SDK (it's ambivalent about the final part of the version number - which is a good thing!). But the same podspec also then adds an entry to the Framework search paths of the xcconfig file using a hardcoded version number, 3.1.0:
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"${PODS_ROOT}/Dropbox-Sync-API-SDK/dropbox-ios-sync-sdk-3.1.0"' }
This causes a compilation error, because it looks for v3.1.0 and ignores what is actually installed, v3.1.1, so it can't find the header files and everything breaks.
Obviously we can manually update the ParcelKit podspec (and indeed, it has already been updated to explicitly reference v3.1.1) but I wondered if there's a more robust way to define this so that if Dropbox ever releases v3.1.2 then the podspec continues to work automatically? i.e. that it will automatically add 3.1.2 to the Framework search paths rather than 3.1.0.
To specify a version like this remove the ~>.
s.dependency 'Foo', '3.1.0'
The different ways to specify a version are explained here

Install Pods via .podspec?

I found some iOS libraries in Github that has a .podspec file, but it does not appear in Cocoapods' repository. Is there any chance I can use pod commands to install this library?
Example library: DDSlidingPanels
Yes. You can copy their podspec into another folder such as ~/.cocoapods/repos/whatever/name/version/name.podspec and then CocoaPods will be able to find it.

Resources