Reputation:
I have created a file called BridgingHeader.h
and it contains only one line:
#import <sqlite.h>
And of course the framework libsqlite3.dylib
is imported either.
In my build settings I've also set the value of Objective-C Bridging Header to <ProjectName>/Bridging-Header.h
BUT…
When I add import sqlite3
to my Swift class it says that it cannot find the module sqlite3
.
Upvotes: 4
Views: 4341
Reputation: 2322
For anyone who does want to use SQLite 3 directly, see this Gist:
https://gist.github.com/zgchurch/3bac5443f6b3f407fe65
Upvotes: 5
Reputation:
Thanks to @trojanfoe I am using now a library which is an Objective-C
wrapper for the sqlite3
framework. (FMDB)
Got it to work by importing the ObjC
header in my BridgingHeader.h
file and using the class without importing anything in the Swift
class.
Conclusion: Only Objective-C files can be imported into the bridging header…
Upvotes: 2