How do I reference SQLite?

It is very, very exciting to see someone take Swift to other platforms. I am looking forward to trying it out with my own personal projects.

With that in mind, I would like to use a SQLite wrapper I have in Xcode in Fire. How do I make the solution reference SQLite so that my code will compile?

Does Fire use a bridging-header file similar to Xcode or do I need to do something else so my code will work properly with SQLite?

I’ll take a look at Sugar for file reference so the wrapper class is device agnostic. (Will the version on GitHub now work or do I need a special version?)

We currently don’t have a platform-agnatic Sqlite abstraction in Sugar yet (we’d love for someone to contribute one ;). Bu you can reference the native SQLite library bon each platform. For Cocoa, we ship an imported .fx file in the box, just add it via Add Reference, for .NET and Java you’ll need to grab the official .dll or .jar file and just reference that.

hth,
marc

Ah, ok. so I just “import SQLite” at the top of my file then?

As for adding it to Sugar… let me get myself cemented in and then I’ll see what I can do :slight_smile:

And add a reference, see References (and maybe also read Namespaces and References, ignore that it targets Delphi developer,s the topic still explains references vs namespaces well).

cool! :wink:

It looks like SQLite is now supported on Android and iOS when looking at the SQLite.pas

I have Sugar.data.jar in my references for my Android project but var connection: SQLiteConnection results in an unknown identifier error.

Is it possible to use SQLiteConnection in the shared project? If so how do I reference it? What am I missing?

Do you have the namespace imported, too?

Yah I tried the imports:

import Sugar
import Sugar.Data
import SQLite
import Sugar.SQLite
import Sugar.SQLiteConnection

but without success

Sugar.Data is what you want to import. It’d be helpful to see the exact error(s) you’re getting, and maybe see a compete project to assist you further and narrow down what is going wrong…

Ah the problem was caused by an old version of sugar.data
Your anwser in post:

worked for me

1 Like