Xcode12封装framework
2020-12-31 本文已影响0人
Jabir_Zhang
封装framework步骤
1、创建工程

2、创建功能类
创建后如图所示:

创建工程时自动生成的头文件可删除,看个人具体情况。

3、配置项目
搜索Linking,修改三处:

因为Xcode12的一些修改,网上说的其他修改处可以不改。
4、设置需要公开或隐藏的头文件,将需要公开的头文件放到Public下

5、引用第三方库,分为直接拖入源码或SDK和使用Pod导入
1、直接拖入一定要注意不要勾选Add to target

2、Pod导入注意要升级cocoapods版本
因为旧版本cocoapods生成的workspace打包FrameWork会报错,需升级到1.10.0。原来我1.9.0配置的项目在打包模拟器状态下报错,原因是Xcode12配置上有所修改。
正常操作,就是先创建Podfile,然后pod install即可。