mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Merge pull request #212 from BendingSpoons/feature/CocoaPods-SQLCipher
SQLCipher support with Cocoapods
This commit is contained in:
commit
49b62cb27a
4 files changed
+48
-5
No files matched your search
@@ -0,0 +1,25 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GRDBCipher'
|
||||
s.version = '0.107.0'
|
||||
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.summary = 'A Swift application toolkit for SQLite databases.'
|
||||
s.homepage = 'https://github.com/groue/GRDB.swift'
|
||||
s.author = { 'Gwendal Roué' => 'gr@pierlis.com' }
|
||||
s.source = { :git => 'https://github.com/groue/GRDB.swift.git', :tag => "v#{s.version}" }
|
||||
s.module_name = 'GRDBCipher'
|
||||
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.osx.deployment_target = '10.9'
|
||||
s.watchos.deployment_target = '2.0'
|
||||
|
||||
s.source_files = 'GRDB/**/*.swift', 'SQLCipher/*.h', 'Support/grdb_config.{c,h}'
|
||||
s.module_map = 'SQLCipher/module.modulemap'
|
||||
s.xcconfig = {
|
||||
'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLITE_HAS_CODEC -DUSING_SQLCIPHER',
|
||||
'OTHER_CFLAGS' => '$(inherited) -DSQLITE_HAS_CODEC -DUSING_SQLCIPHER',
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_HAS_CODEC=1'
|
||||
}
|
||||
s.framework = 'Foundation'
|
||||
s.dependency 'SQLCipher', '~> 3.4.0'
|
||||
end
|
||||
@@ -4579,7 +4579,14 @@ try controller.performFetch()
|
||||
|
||||
**GRDB can encrypt your database with [SQLCipher](http://sqlcipher.net) v3.4.0.**
|
||||
|
||||
This requires a manual installation of GRDB:
|
||||
You can use [CocoaPods](http://cocoapods.org/) (version 1.1 or higher), and specify in your `Podfile`:
|
||||
|
||||
```ruby
|
||||
use_frameworks!
|
||||
pod 'GRDBCipher'
|
||||
```
|
||||
|
||||
Alternatively, perform a manual installation of GRDB and SQLCipher:
|
||||
|
||||
1. Clone the GRDB.swift git repository, checkout the latest tagged version, and download SQLCipher sources:
|
||||
|
||||
@@ -4587,7 +4594,7 @@ This requires a manual installation of GRDB:
|
||||
cd [GRDB.swift directory]
|
||||
git checkout v0.107.0
|
||||
git submodule update --init SQLCipher/src
|
||||
````
|
||||
```
|
||||
|
||||
2. Embed the `GRDB.xcodeproj` project in your own project.
|
||||
|
||||
@@ -4595,6 +4602,7 @@ This requires a manual installation of GRDB:
|
||||
|
||||
4. Add the `GRDBCipher.framework` from the targetted platform to the **Embedded Binaries** section of the **General** tab of your target.
|
||||
|
||||
|
||||
**You create and open an encrypted database** by providing a passphrase to your [database connection](#database-connections):
|
||||
|
||||
```swift
|
||||
|
||||
@@ -8,4 +8,8 @@ FOUNDATION_EXPORT const unsigned char GRDB_VersionString[];
|
||||
|
||||
#define SQLITE_HAS_CODEC
|
||||
#import <GRDBCipher/GRDBCipher-Bridging.h>
|
||||
#import <GRDBCipher/sqlite3.h>
|
||||
#ifdef COCOAPODS
|
||||
#import <SQLCipher/sqlite3.h>
|
||||
#else
|
||||
#import <GRDBCipher/sqlite3.h>
|
||||
#endif
|
||||
@@ -1,5 +1,11 @@
|
||||
#include <GRDB/grdb_config.h>
|
||||
#include <GRDB/sqlite3.h>
|
||||
#if USING_SQLCIPHER && defined(COCOAPODS)
|
||||
#include <GRDBCipher/grdb_config.h>
|
||||
#include <SQLCipher/sqlite3.h>
|
||||
#else
|
||||
#include <GRDB/grdb_config.h>
|
||||
#include <GRDB/sqlite3.h>
|
||||
#endif
|
||||
|
||||
|
||||
void registerErrorLogCallback(errorLogCallback callback) {
|
||||
sqlite3_config(SQLITE_CONFIG_LOG, callback, 0);
|
||||
|
||||
Reference in new issue
Block a user