Reputation: 1009
I recently updated to Xcode 7.0 and am trying to build my project which uses the SQLite.swift library. After converting to the latest swift syntax (Edit->Convert->To Latest Swift Syntax...) I get so many errors and I don't know where to begin fixing them. I also tried to convert the SQLite.swift project separately but always get many warnings at compilation time and some errors like:
/Users/dobrev/Development/iOS/SQLite.swift/SQLite/Statement.swift:25:30: error: cannot invoke initializer for type 'sqlite3_destructor_type' with an argument list of type '(COpaquePointer)'
internal let SQLITE_STATIC = sqlite3_destructor_type(COpaquePointer(bitPattern: 0))
^
/Users/dobrev/Development/iOS/SQLite.swift/SQLite/Statement.swift:26:33: error: cannot invoke initializer for type 'sqlite3_destructor_type' with an argument list of type '(COpaquePointer)'
internal let SQLITE_TRANSIENT = sqlite3_destructor_type(COpaquePointer(bitPattern: -1))
which at the end result in Command failed due to signal: Segmentation fault 11
Can someone help?
Upvotes: 0
Views: 621
Reputation: 1
#define SQLITE_STATIC ((sqlite3_destructor_type)0)
#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
from <sqlite3.h>
are not imported to Swift, probably due to the "unsafe" pointer casting.
A possible Swift definition is shown in the SQLite.swift project, in Statement.swift:
let SQLITE_STATIC = sqlite3_destructor_type(COpaquePointer(bitPattern: 0))
let SQLITE_TRANSIENT = sqlite3_destructor_type(COpaquePointer(bitPattern: -1))
For Swift 2 you will need
let SQLITE_STATIC = unsafeBitCast(0, sqlite3_destructor_type.self)
let SQLITE_TRANSIENT = unsafeBitCast(-1, sqlite3_destructor_type.self)
Upvotes: 0