Squeal, a Swift interface to SQLite
Squeal allows SQLite databases to be created and accessed from Swift code. Squeal's goal is to make the most common SQLite tasks easy in Swift, while still providing complete access to SQLite's advanced features.
- Access any SQLite database, or multiple databases at a time.
- Easy interface to select rows from a database.
- Helper methods for most common types of SQL statements.
- Compile and reuse SQL for optimal performance.
- Simple DatabasePool implementation for concurrent access to a database.
- No globals.
- Thoroughly tested with Quick and Nimble.
Clone this project into your project directory. E.g.:
cd ~/SwiftProject mkdir Externals git clone https://github.com/nerdyc/Squeal.git Externals/Squeal
Squeal.xcodeprojto your project by selecting the 'Add files to ...' item in the 'File' menu.
Link Binary With Librariessection of app or framework's
Build Phases. Be careful to select the framework for your platform -- Mac or iOS.
You can do this by selecting your project in XCode's Project navigator (the sidebar on the left), then select
Build Phasesfor your app or framework's target.
module.mapto your project's
Within your target or project's
Build Settings, set the
Import Pathssetting to
$(PROJECT_DIR)/Externals/Squeal/modules. If you cloned
Squealto a different location, then modify the example value to match.
Build and run.
Step #4 (adding the
module.map) is necessary because SQLite is a library not a module. Swift can only import
modules, and the
module.map defines a module for SQLite so it can be imported into Swift code.
NOTE: If see an issue like "Could not build Objective-C module 'sqlite3'", ensure you have the XCode command-line tools installed. They're required for the module.map to work correctly.
To get an overview of using Squeal, please check out the playground included in the project.
Squeal is released under the MIT License. Details are in the
LICENSE.txt file in the project.
Contributions and suggestions are very welcome! No contribution is too small. Squeal (like Swift) is still evolving and feedback from the community is appreciated. Open an Issue, or submit a pull request!
The main requirement is for new code to be tested. Nobody appreciates bugs in their database.
Squeal benefits greatly from the following two testing libraries: