What is the difference between “import” of framework and “linking” with framework?

前端 未结 1 1397
生来不讨喜
生来不讨喜 2021-01-02 15:51

I\'m new in Xcode and in Swift language. I\'m trying to understand the usage of the \"import\" in ViewController and the \"framework import\" in my project. Example: if I u

相关标签:
1条回答
  • 2021-01-02 16:38

    The import in the source code facilitates compilation of your code, ensuring that the correct headers are found. The "Link Binary with Libraries" section of the "Build Phases" in "Project Settings" (now also included on the "Summary" tab under "Linked Libraries and Frameworks") specifies with which frameworks and libraries your object code will be linked.

    Historically we always needed to specify these two separately, but now there is a project setting "Link Frameworks Automatically", which if on, will automatically link the framework to your project if you import it in your source code. You also must have "Enable Modules" turned on, too.

    0 讨论(0)
提交回复
热议问题