Swift: using private framework

后端 未结 2 1579
天涯浪人
天涯浪人 2021-02-07 23:56

I have built an iOS Swift framework with Xcode.

After writing the code I have build the project and took the .framework file inside the Products folder to test it.

相关标签:
2条回答
  • 2021-02-08 00:16

    To actual a self defined framework, u really have to do a lot of things.

    Firstly, make sure ur framework is used on right device. It's to say framework can only be used on corresponding device(either one of Simulator, Device and Mac). In other words, if framework A built on simulator, project import framework A can only pass compile and successfully built on simulator.

    P.S. if universal version desired, -lipo command is what u need to further explore.

    Secondly, during implementing ur framework , make sure all the classes, methods and variables u want use outside start with Public.

    Thirdly, check ur project setting Embedded Binaries and linked Frameworks and Libraries do contain ur framework.

    0 讨论(0)
  • 2021-02-08 00:19

    When you're referencing a framework in the products directory from your workspace, ensure that the location is "Built Products" and the filename is just the framework name, without any additional path components.

    If you're referencing a framework that isn't in your workspace, I would recommend using Carthage instead of copying it directly into your repository. This will make versioning much easier, and will ensure that it is built correctly for both simulator and device.

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