The first step:
Step Two, build the bridging filecasually create a class, the language chooses OC, and then it asks if you want to create a bridging mode, and then you choose Yes.that class can be deleted.add a sentence to the bridging file #import <sqlite3.h> then we can create a database or a table.//equivalent to C language pointersvar db:opaquepointer? = Nil//Create or open a databasefunc createoropendatabase () {print ("\ (Nshomedirectory ())") Let path:nsstring = "\ (documentspath)/test.sqlite3" as NSStringlet filename = path.utf8string if Sqlite3_open (filename, &db)! = SQLITE_OK {print ("Create or Open Failed ...")sqlite3_close (db)}}//Create student Tablesfunc createtable () {Let string:nsstring = "CREATE table if not exists Student (ID integer primary key autoincrement, sno text, name text, Score integer) "Let sql = string.utf8stringif SQLITE3_EXEC (db, SQL, nil, nil, nil)! = SQLITE_OK {print ("CREATE TABLE failed ...")sqlite3_close (db)}}
Introduction to SQLite