到目前为止,answer from Martin R已经完美运作了。但是从Swift2开始,它现在会引发错误
无法使用类型为'(COpaquePointer)'的参数列表调用类型'sqlite3_destructor_type'的初始值设定项
在这些方面:
private let SQLITE_STATIC = sqlite3_destructor_type(COpaquePointer(bitPattern: 0)) // https://stackoverflow.com/a/26884081/1271826
private let SQLITE_TRANSIENT = sqlite3_destructor_type(COpaquePointer(bitPattern: -1))
答案 0 :(得分:4)
从@MartinR提供的github帖子中获得答案
internal let SQLITE_STATIC = unsafeBitCast(0, sqlite3_destructor_type.self)
internal let SQLITE_TRANSIENT = unsafeBitCast(-1, sqlite3_destructor_type.self)