1

I know this have been asked multiple times, but I still couldn't find the right answer.

I have a project (React Native) that already has a lot of code, lots of dependencies, xcode tweaks, etc. Far away from a vanilla project.

I want to add cocoa pods to it because some third party library can only be installed with it. However, I can't find anywhere information about if I need to "migrate" all my third party packages as well to cocoa pods (move all the linked dependencies there), or is it enough to create a fresh pod file with just those two new dependencies, and everything else should work just fine.

2 Answers 2

1

Install CocoaPods on System

Step.1 Open Terminal and enter the following command:

sudo gem install cocoapods

Create Podfile for Project

Step.2 now you need to close Xcode.

Open Terminal at project's root folder

Step.3 Next, enter below command to create podfile:

pod init

Edit podfile

Note: Make sure we will edit podfile with Xcode not TextEdit etc.

Step.4 Type this command to open the Podfile using Xcode for editing:

open -a Xcode Podfile

Step.5 update pode file what you want. for example

pod 'SwiftForms'

when you add this line it wii installing at next step :)

let's go for install

Step.5 Enter the following command in Terminal and hit Enter

pod install

Thats it!! we have done.

Open Project with pods

Now go to the project folder,we can see that CocoaPods created a new project_name.xcworkspace file and a Pods folder.

open project_name.xcworkspace with xcode

Sign up to request clarification or add additional context in comments.

3 Comments

This is what I did, but it still doesn't answer my question. Do I need to manually add to the podfile all my existing third party libraries that were previously manually linked, or just the one that needs a podfile? I'm asking this because right now adding a podfile just breaks my whole project and it won't compile.
@CristianoCoelho yes you must all of your third party library must be in your new pod file. because it is creating new .xcworkspace file with your pod file. i wish it is helping you.
Is there a way to migrate an xcode project to pods then? This is just silly
0

This article has the answer I needed in a very similar situation: https://medium.com/@soufianerafik/how-to-add-pods-to-an-xcode-project-2994aa2abbf1

Essentially this:

  1. install Cocoapods, if needed
  2. terminal to your project root
  3. pod init
  4. pod install

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.