在Swift中使用SQLite要导入libsqlite3.tbd框架,
因为此框架为C语言编写,所以需要:
1.Project->General->Linked Frameworks and Libraries->"+"->Search:sqlite->“libsqlite3.tbd”
2.建一个桥接文件,command+N 选“Header File”,在桥接文件中输入:#import<sqlite3.h>
3.在Build Settings中搜索关键字“bridging”,找到“Swift Compiler - Code Generation”下的“Objective-C Bridging Header”,双击右边空白处,在弹出框中输入路径:"工程名/桥接文件名.h" ,command+B编译一下看有无报错。
成功后即可在.swift中使用。
Xcode7后在引入动态库时 .tbd取代了.dylib,苹果官方解释:
...the .tbd files are new "text-based stub libraries", that provide a much more compact version of the stub libraries for use in the SDK, and help to significantly reduce its download size.
It aims to reduce the Apps' size...
I guess "tbd" is the abbreviation of "text-based"...基于文本的...