Ios – How to add frameworks into the Swift project

iosswift

I want to add a library to my Swift project. I found 3 different places to add.
I want to know the correct way to do this and the purpose of each one.

General tab

select the target -> general

  • Embed binaries
  • Linked frameworks and libraries

Build phase

select the target -> build phase

  • Embed frameworks
  • link binary with libraries

New copy file phase

select the target -> click on + button -> select "New copy file phase"

  • choose the destination as a framework
  • select the framework

Questions

  1. When do I need to "Embed binaries" and "Linked frameworks and
    libraries"? and when do I need to do the build phase one?
  2. Do I need to do multiple of these things to add a framework?
  3. What is the difference between them?

Best Answer

1.Select the project file from the project navigator on the left side of the project window.

2.Select the target for where you want to add frameworks in the project settings editor.

3.Select the “Build Phases” tab, and click the small triangle next to “Link Binary With Libraries” to view all of the frameworks in your application.

4.To Add frameworks, click the “+” below the list of frameworks.

5.To select multiple frameworks, press and hold the command key while using the mouse to click the desired frameworks.

enter image description here