Do others need to install CocoaPods to build my project? - ios

I have made an app for a university project, which uses CocoaPods for dependency management (I have 2 pods included). I have to upload this project, and provide an installation guide for a reviewer. My question is: will others be able to just open the xcworkspace file as is, or do they also need to install cocoapods themselves?

It depends on how you plan to give your source code to the reviewers.
Cocoapods is just a way of installing and managing libraries. If all you do is zip your project folder and send it to the reviewers, they won't need to install Cocoapods because the needed Pods are already included in your project.
If you planned on giving them the code by giving them access to your repository, they will need Cocoapods if your repository ignores the Pods folder (ex: you added the Pods folder in your .gitignore). If your Pods are commited to the repository, they won't need it.

Related

Retrieve pod from a folder inside a repo

Currently we need to work with a library which has been merged into another project. That library has its own podspec and was previously available as a remote pod from its own git repo. After it was merged in the big project, the big project uses that pod with a local path.
We still need that library in our project but fetching the whole "merged" project for that pod does not seem legit.
Is there any way to specify a path in the Podsfile which would be able to retrieve the pod from a folder inside an existing git repo?
As I understand you - you're trying to fetch some existing part of the repo as a cocoapod.
So, if this library is not a pod itself - no, it's not possible. You can install libraries (read frameworks) via cocoapods only if they have a pod published, or created by you locally.
You basically have two options here:
Move this code to git-submodule and use it in both projects
Create a pod by yourself (locally, or publish it) and use it in both projects via cocoapods
The second way is preferable, cause cocoapods themselves save you a lot of nerves during construction or maintenance.
If you want some help on any approach - feel free to ask here.

iOS Practice for using cocoapod and source control

Currently, in our company, we just commit all pods (like AFNetworking, Realm, etc) to svn/git. From time to time, when other developer install pod, update pod, there are conflict.
We also use this so that we don't touch other pods.
pod install --no-repo-update
Can I know what is the good practice for using third party pods? Do I need to commit those pods?
Or just do pod install again after our codes are checked out ? I just want to avoid code conflict for using pods.
You can refer to http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
Whether you check in or not, the Pods directory, the Podfile and Podfile.lock should always be kept under version control. It is recommended to keep it under version control and don't add it to your .gitignore
We also faced the same problem.As a solution, in commit we write only pod file with required pod list . Whenever other person take update, his podfile is updated and then from console he update his project pods.
As pod is same for all so you dont need to commit the pods. for more specific you can you can give pod with version.
Khant usually it's not a good practice to upload your dependencies to your repositories mostly because your will be saving space and time. it's ok to push your Podfile but all the code of your dependencies should be omitted and installed locally for each developer. And each time a new dependency is added or update you will just need to run the pod update command. to do that you can add to your .gitignore file on a new line just Pods/.
Either way if you are working on a big scale application you should on swift you should follow the best practices and use a correctly .gitignore setup like this one example and also if you want to know some pros and cons on avoiding Cocoapods dependencies you can check this official documentation
In my opinion, we don't push all pods to svn or git. You can commit only Podfile and may want to freeze to a specific version of a Pod, in which case you can specify that version number.
pod 'Objection', '0.9'
And when other members install pods, it will be same.

How to download Podspec dependencies for local development

This seems like something that should be done very easily. I don't know why I just can't seem to find a simple answer to that.
I am creating a pod library that has a pod dependency.
So in my .podspec, I have a s.dependency 'SomePod', '~> 1.0'. Since I am writing my library using SomePod, I want the source files from it in order to import it and use it. Sure one way to do it is to have a PodFile in the repo and then pod install the SomePod.
But is there some other way to download the somePod dependency so that I can use it in my library? What is the best practice around that to have a clean structure?
FYI, I am using the Cookie Cutter library in order to generate all my project structure. What's left for me to do is download those podspec dependencies and avoid using Podfile and pod install since I already have a .xcworkspace generated from Cookie Cutter, so pod install won't like that and will go crazy.
Well you could handle the dependency management with other Tools (Carthage etc.) or simply on your own (git clone + project integration), but as you are already providing a podspec for your lib, why not just stick to cocoapods for third party lib integration?
This would be the typical approach for your setup, as you just need to write a simple Podfile, assure that SomePod is fetched with the same version as defined in podspec and call pod install.
Advantages:
you can still watch third party sources
you can debug into third party lib
you can compile, test & debug against the exact same version of SomePod that will be fetched from a client project of your lib (no need to keep versions manually in sync)

Xcode cannot see the file added manually into cocoapod

I maintain my 3rd party libs with cocoapods. But recently I found some bugs and would like to add some new features to one of the libs so I manually created some .h and .m files in one of the libs.
However when importing those added .h files, Xcode gave the file not found error and couldn't compile them.
How can I solve the problem?
Thanks.
When integrating the Pods into your project, CocoaPods generates libraries that cannot be easily modified from Xcode. If you're having CocoaPods build frameworks, instead, those cannot be modified at all. You usually have to rerun pod install or pod update to let CocoaPods regenerate them if you add files to a Pod.
If you want to reliably add files to a Pod, you should checkout a copy on your machine, somewhere NOT in you project's folder and use something like the following to tell CocoaPods that that one Pod is one you're developing and therefore should integrate differently:
pod MyPod, :path => 'path/to/MyPod.podspec'
Still, even in this case, if you add files to the Pod, although it's easier to add them from Xcode, you might want to rerun the pod command line tool to have CocoaPods reintegrate your pod. However, in this case, you'll only have to make sure your files are added to the right project target in order to add files directly from Xcode.

What are the complications of introducing cocoapods into a collaborative iOS project?

I would like to avoid dealing with frustration of importing other projects into my iOS project, so I'm considering using CocoaPods. One of the requirements of using this dependency manager is that I can no longer open .xcodeproj directly, and instead am required to open .xcworkspace.
While I could simply zip the project and send it over to a colleague, can I somehow send a workspace managed by cocoapods, or will the recepient have to have cocoapods installed?
Are there additional complications of using version-control tools, like Git for xcode workspaces managed by CocoaPods?
Thank you !
You need cocoaPods only to install pods, but not to build/run the project so you can continue to zip the folder containing your project and send it to a colleague that does not have pod installed.
Check your Podfile and Podfile.lock in to source control. Add *.xcworkspace to your .gitignore and ask any collaborators to run pod install when they download it.
This is the same process as anything with dependency management such as bundler for Ruby.

Resources