1

I'm fairly new to Cocoapods, and I'm hoping this is a question easily answered by 'RTFM', but the 'M' provided by Cocoapods doesn't seem to answer my question.

I'm applying SwiftLint to my projects.

I can easily add it to my projects that include other pods (simply add "pod 'SwiftLint', '~> 0.24'"), but I'm having difficulty adding it to my Cocoapod project.

Like I said, I'm really just a couple of weeks into Cocoapods, and know there's a ways down this rabbit-hole. This project is also a conversion from a previous structure, so it wasn't a 1-to-1 conversion to the Cocoapods structure.

The problem is that I need to be able to add SwiftLint to the BMLTiOSLib project in the same way that I do in the projects that incorporate BMLTiOSLib. This is something that I'd run at build time for BMLTiOSLib.

When I write up a podfile for SwiftLint, I get a number of collisions, and, quite frankly, I don't know enough about the inner workings of Cocoapods to properly diagnose them.

Is there a fairly basic guide to including things like SwiftLint into a Cocoapod project?

Chris Marshall
  • 4,910
  • 8
  • 47
  • 72

2 Answers2

2

When you are in the Cocoapod project, you need to write in the Podspec that your project has a dependency on SwiftLint, not just add it :

Pod::Spec.new do |spec|
...
  spec.dependency 'SwiftLint'
end
barbarity
  • 2,420
  • 1
  • 21
  • 29
  • I did that. Nothing happens. I think there's something else I need to do. Since I don't do a 'pod update' or 'pod install', I don't bring in a SwiftLint pod, and I can't test it (Really, I'm not that interested in exporting SwiftLint. I need it for my own work). – Chris Marshall Dec 10 '17 at 21:27
  • I suspect the issue is that when I set the project up, I didn't deviate much from the auto-generated boilerplate. I think I need to spend some quality time, examining my project settings. – Chris Marshall Dec 10 '17 at 23:12
  • Wow. Just...wow. Looks like I'll need to completely restructure the project from scratch (not a big deal), starting with "Ignore Cocoapods boilerplate." – Chris Marshall Dec 11 '17 at 12:15
  • One of the reasons this might be happening is because Cocoapods was intended to be a dependency manager of a project, not some tool for XCode... – barbarity Dec 11 '17 at 12:35
  • Yeah...it would happen with other dependencies, too. The issue is that the boilerplate has some xcconfigs that clash with dependent pods. In my case, the easiest thing to do was to simply restart the structure (there's only 3 files in the framework), and not use xcconfigs. It seems that most folks, these days, wouldn't know Ockham's Razor if they shaved with it. – Chris Marshall Dec 11 '17 at 17:58
0

Just wanted to mention that this was solved. The issue is that the boilerplate xcconfig files have header search paths encoded in them that argue with new pods (not just SwiftLint).

It's not that difficult to fix, but I decided to toss the boilerplate anyway, simply because it made a very simple little framework into a byzantine mess.

Chris Marshall
  • 4,910
  • 8
  • 47
  • 72