diff --git a/GRDBCipher.podspec b/GRDBCipher.podspec new file mode 100644 index 000000000..77b0ae533 --- /dev/null +++ b/GRDBCipher.podspec @@ -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 diff --git a/README.md b/README.md index c016228f1..daa15635d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/SQLCipher/GRDBCipher.h b/SQLCipher/GRDBCipher.h index dda719bde..82d9edb59 100644 --- a/SQLCipher/GRDBCipher.h +++ b/SQLCipher/GRDBCipher.h @@ -8,4 +8,8 @@ FOUNDATION_EXPORT const unsigned char GRDB_VersionString[]; #define SQLITE_HAS_CODEC #import -#import +#ifdef COCOAPODS + #import +#else + #import +#endif diff --git a/Support/grdb_config.c b/Support/grdb_config.c index d68ef20b5..3a75f975c 100644 --- a/Support/grdb_config.c +++ b/Support/grdb_config.c @@ -1,5 +1,11 @@ -#include -#include +#if USING_SQLCIPHER && defined(COCOAPODS) + #include + #include +#else + #include + #include +#endif + void registerErrorLogCallback(errorLogCallback callback) { sqlite3_config(SQLITE_CONFIG_LOG, callback, 0);