I'm working with a CocoaPod private library. We have mock files that are being used for our Swift Previews.
What's surprising is that these mock files aren't added as a member to the pod's target. They're a a member of the Test Target. Yet they compile.
I don't understand why/how it's working
When I further inspected the setup I noticed that within the
PodSpec, for itssource_filesfield I saw something like the following:I believe the source files are added onto the target if either:
pod installlater adds them onto the 'Build Phase' of target under 'Compile Sources'source_filespaths. ATTENTION: things work only up until you do apod install. As soon as you dopod installit will stop working becausepod installwill remove it from the Build Phase. Hence this isn't something you should do or rely on. I just mentioned it as insight for debugging things.Tldr the PodSpec will supercede your Xcode configurations because
pod installoverrides things.But why is CocoaPods like this?
I suppose mainly because it wants to have a higher focus on the Swift/Objective-C language and less focus on Xcode.
When you rely on paths instead of a very specific Xcode project file, then other tools like the terminal, vim, VSC can be used a lot easier.
Like you don't need Xcode running (you need the Xcode Command Line Tools installed though) to execute
pod lib lint. And this in itself is a great advantage. It simplifies the development process.