Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integarte/Install cocoapods to existing xcode project, objective-c or swift

Tags:

I was looking for integrating cocoapods to my existing xcode projects.

I found these few post but they are based on issue instead my problem.

not able to acess installed pods framework

How to add cocoapods to existing workspace not project (this one is for work-space not project)

Making a CocoaPod from an existing Xcode project (this one is more on integrating swift with objective c project)

So I spending quality time i did for my project. I am sharing step by step integration in my answer post.

please feel free to suggest and improvement.

happy to learn and share

like image 351
swiftBoy Avatar asked Mar 18 '16 12:03

swiftBoy


People also ask

How do I add CocoaPods to swift package?

Add Swift Package Manager After you've mourned the loss of CocoaPods, let's replace it with SPM. Hopefully, you've taken notes of all the dependencies you had. Open your . xcodeproj , select the option "Add Package Dependency" in File > Swift Packages, and paste the URL of your dependency's git repository.


1 Answers

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 as shown below screenshot, save and close.

enter image description here

Install lib/framework

Now we have added our required lib/framework pod command

pod 'SwiftForms' 

let's go for install

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

pod install

Result screen

enter image description here

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

your project structure should look like

enter image description here

like image 190
swiftBoy Avatar answered Sep 27 '22 22:09

swiftBoy