静态页面启用swiper
Summary
摘要
- Create a Static Library with C and Swift in Xcode 在Xcode中使用C和Swift创建静态库
- Enable Bitcode on the Static Library create 在创建静态库时启用位码
- Distributing compiled iOS Swift static libraries 分发已编译的iOS Swift静态库
- Integrate the Static Library into a iOS swift application 将静态库集成到iOS swift应用程序中
Create a Static Library with C and Swift in Xcode
在Xcode中使用C和Swift创建静态库
Open Xcode and create a new project
打开Xcode并创建一个新项目
Now add your C code to the project or write the C code. When you create a new C file Xcode will ask to create bridging header file, Tap on Create Bridging Header
.
现在,将C代码添加到项目中或编写C代码。 当您创建一个新的C文件时,Xcode将要求创建桥接头文件,点击Create Bridging Header
。
If the bridging header is not create then create a new .h file and add the file path to Objective-C Bridging header
in the Target → Build Settings
如果没有创建桥接头,则创建一个新的.h文件,并将文件路径添加到Target→Build Settings中的Objective-C Bridging header
中。
Add all the required C header files in the bridging header which needs to be accessed in swift.
将所有必需的C头文件添加到需要快速访问的桥接头中。
Enable Bitcode on the Static Library create
在创建静态库时启用位码
Note: Just setting
Enable Bitcode
toYES
in the Build Settings will not allow the application to archive注意:仅在“构建设置”中将
YES
Enable Bitcode
YES
设置为YES
”,将不允许应用程序存档
Step 1:
第1步:
Goto Project Settings → Build Settings → Other C flags and set debug with —fembed-bitcode-marker
and release with —fembed-bitcode
转到项目设置→构建设置→其他C 标志,并使用—fembed-bitcode-marker
设置调试,并使用—fembed-bitcode
释放
Step 2:
第2步:
Goto Project Settings → Build Settings, click on the + sign at the top to Add User-Defined Setting
转到项目设置→构建设置,单击顶部的+号以添加用户定义的设置
Add a new setting by nameBITCODE_GENERATION_MODE
and set debug with marker
and release with bitcode
通过名称BITCODE_GENERATION_MODE
添加新设置 并使用marker
设置调试并使用位bitcode
释放
Distributing compiled iOS Swift static libraries
分发已编译的iOS Swift静态库
Set the active scheme to Generic iOS Device
and Tap on build
将活动方案设置为Generic iOS Device
并点击构建
Once the build is successful, expand Products
folder, open the .a file in finder and copy both .a file and .swiftmodule
folder and this can used in other project as static library
构建成功后,展开Products
文件夹,在finder中打开.a文件,然后复制.a文件和.swiftmodule
文件夹,这可以在其他项目中用作静态库。
Note: both .a file and .swiftmodule folder are required
注意:.a文件和.swiftmodule文件夹都是必需的
Integrate the Static Library into a iOS swift application
将静态库集成到iOS swift应用程序中
Open an iOS application create a lib
folder and add both .a file and .swiftmodule folder into the lib folder and check if the .a file is listed in Frameworks, Libraries, and Embedded Content
if not add the file.
打开一个iOS应用程序,创建一个lib
文件夹,并将.a文件和.swiftmodule文件夹都添加到lib文件夹中,并检查.a文件是否在Frameworks, Libraries, and Embedded Content
列出,如果未添加该文件。
Goto Target → Build Settings and check if lib
folder is added to Library Search Paths
and Import Paths
if not add it.
转到目标→构建设置,并检查是否将lib
文件夹添加到Library Search Paths
,如果未添加,则Import Paths
。
Hurry!!!!!!
匆忙!!!!!!
Now you are good to go and use the Static Library inside a iOS project.
现在您可以在iOS项目中使用静态库了。
静态页面启用swiper