Jason Foglia
Jason Foglia

Reputation: 2571

Swift SQLite Linux/Ubuntu

Wanting to give Swift a try and cheaply as possible.

I'm running

All is working, not pretty though, but I'm having a hell of a time connecting to SQLite within Swift.

Has anyone successfully connected and run a query against SQLite with this setup?

While I've seen a bunch of post for iOS solutions I'm not entirely sure these will work on Ubuntu. I wasn't sure if you could or needed to compile Objective-C on Ubuntu.

Upvotes: 2

Views: 629

Answers (1)

Anatoli P
Anatoli P

Reputation: 4891

Since Objective-C as used on Apple's platforms is not well supported on Linux, I think a better approach might be to access the SQLite C API from Swift by either using a system module or bridging header. You might also want to wrap the SQLite API in a C library exposing a subset of the API that you need in a simplified form more suitable to be called from Swift. You would then invoke the wrapper by creating a system module for it (no system module is needed in this case for the SQLite API) or by using a bridging header.

The following may help:

Compile C code and expose it to Swift under Linux

Linking a C library and its supporting library in Swift (linux)

Upvotes: 1

Related Questions