Pradumna Patil
Pradumna Patil

Reputation: 2220

Swift Framework with Cocoa Pods

I have created custom swift framework in this I have installed pods for using some third party framework.

I am done with the successful build now but How I can use or add that framework in my existing project.

Do I need to copy the entire framework project in my existing project?

If any one knows the solution please help.

Thank you.

Upvotes: 1

Views: 2293

Answers (4)

sanyam jain
sanyam jain

Reputation: 202

I was also facing the same problem and here's what I did

  1. Open the custom framework you are creating, under products section in the navigation bar right click on the your custom framework (eg customFramework.framework) file and select "reveal in finder".

  2. Now along with your custom framework you can see all the third party frameworks you are using. Copy all the frameworks you need and paste them wherever you feel like so you can easily access to them.

  3. Now open up your existing project where you want to use your custom framework.

  4. Go to Embedded Binaries section in the general tab of your target. Click on the + button -> click on add other -> navigate to location where you pasted all your required frameworks along with your custom framework and click open.

That's it. Do this and let me know if it helped you.

Upvotes: 2

Francesco Destino
Francesco Destino

Reputation: 349

  1. In your main project click with right click and select "Add files to yourProject.."
  2. Then you add the file .xworkspace of your framework, so you can modify from there parts of code.
  3. After that go on the General page of Xcode, when you can select deployement Target, devices etc.. Go down until you see the section of Embedded Binaries, click on the button + and add the framework you added before with the command "Add files to yourProject.." in part 1

Upvotes: 1

Aleem
Aleem

Reputation: 3291

  • Build your framework and copy from Product. As shown in screenshot CyptoAPI.framework

enter image description here

  • Drag into you existing project and also add into Embedded Binaries.

enter image description here

Hope this will help.

Upvotes: 1

Ratul Sharker
Ratul Sharker

Reputation: 8013

The most obvious, easiest and manageable solution would be creating a pod. Then declare the required pods in xyz.podspec file to use your pod as dependencies.

Use your custom cocoapod using following:

pod 'Name', :path => '~/code/Pods/' # if in local file system
pod 'NAME', :git => 'https://example.com/URL/to/repo/NAME.git' # if it is in your private repo

Upvotes: 0

Related Questions