Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Update for swift 4 #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.0
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode8
osx_image: xcode9
language: objective-c

# cache: cocoapods
Expand All @@ -12,7 +12,7 @@ before_install:
#- set -o pipefail && xcodebuild test -workspace Example/EncryptedDATAStack.xcworkspace -scheme EncryptedDATAStack-Example -destination 'platform=iOS Simulator,name=iPhone 7' ONLY_ACTIVE_ARCH=NO | xcpretty
#- pod lib lint

script:
script:
- xcodebuild -workspace Example/EncryptedDATAStack.xcworkspace -scheme EncryptedDATAStack-Example -sdk iphonesimulator build test -destination 'platform=iOS Simulator,name=iPhone 7' | xcpretty -c && exit ${PIPESTATUS[0]}
- pod lib lint --allow-warnings

Expand Down
2 changes: 1 addition & 1 deletion EncryptedDATAStack.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'EncryptedDATAStack'
s.version = '7.0.3'
s.version = '8.0.0'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version number is meant to be in sync with DataStack. I guess it could be changed to 7.0.3.1 to avoid any overlap.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entirely up to yourself :) @flipacholas - Thanks for taking a look I will leave the pull request for you to either close or accept after amending to suit your needs.

s.summary = 'Set up your encrypted database with only 1 line of code!'

s.description = <<-DESC
Expand Down
6 changes: 3 additions & 3 deletions EncryptedDATAStack/Classes/EncryptedDATAStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ import EncryptedCoreData
}

// Can't be private, has to be internal in order to be used as a selector.
func mainContextDidSave(_ notification: Notification) {
@objc func mainContextDidSave(_ notification: Notification) {
self.saveMainThread { error in
if let error = error {
fatalError("Failed to save objects in main thread: \(error)")
Expand All @@ -370,14 +370,14 @@ import EncryptedCoreData
}

// Can't be private, has to be internal in order to be used as a selector.
func newDisposableMainContextWillSave(_ notification: Notification) {
@objc func newDisposableMainContextWillSave(_ notification: Notification) {
if let context = notification.object as? NSManagedObjectContext {
context.reset()
}
}

// Can't be private, has to be internal in order to be used as a selector.
func backgroundContextDidSave(_ notification: Notification) throws {
@objc func backgroundContextDidSave(_ notification: Notification) throws {
if Thread.isMainThread && TestCheck.isTesting == false {
throw NSError(info: "Background context saved in the main thread. Use context's `performBlock`", previousError: nil)
} else {
Expand Down
24 changes: 16 additions & 8 deletions Example/EncryptedDATAStack.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = MT49Z4H3J6;
LastSwiftMigration = 0800;
LastSwiftMigration = 0930;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0930;
TestTargetID = 607FACCF1AFB9204008FA782;
};
};
Expand Down Expand Up @@ -467,7 +467,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -507,7 +507,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -523,11 +523,13 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = MT49Z4H3J6;
INFOPLIST_FILE = EncryptedDATAStack/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.EncryptedDATAStack-Example2";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -539,18 +541,21 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = MT49Z4H3J6;
INFOPLIST_FILE = EncryptedDATAStack/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.EncryptedDATAStack-Example2";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
607FACF31AFB9204008FA782 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 84ABCD5D8B03D2935C3A658E /* Pods-EncryptedDATAStack_Tests.debug.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -563,7 +568,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EncryptedDATAStack_Example.app/EncryptedDATAStack_Example";
};
name = Debug;
Expand All @@ -572,6 +578,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = B6BFDD279D32D9ABFA1C9E90 /* Pods-EncryptedDATAStack_Tests.release.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -580,7 +587,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EncryptedDATAStack_Example.app/EncryptedDATAStack_Example";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -29,10 +39,15 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
}
4 changes: 2 additions & 2 deletions Example/EncryptedDATAStack/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ViewController: UITableViewController {
self.navigationItem.leftBarButtonItem = mainButton
}

func createBackground() {
@objc func createBackground() {
self.dataStack.performInNewBackgroundContext { backgroundContext in
let entity = NSEntityDescription.entity(forEntityName: "User", in: backgroundContext)!
let object = NSManagedObject(entity: entity, insertInto: backgroundContext)
Expand All @@ -52,7 +52,7 @@ class ViewController: UITableViewController {
}
}

func createMain() {
@objc func createMain() {
let entity = NSEntityDescription.entity(forEntityName: "User", in: self.dataStack.mainContext)!
let object = NSManagedObject(entity: entity, insertInto: self.dataStack.mainContext)
object.setValue("Main", forKey: "name")
Expand Down
2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use_frameworks!

target 'EncryptedDATAStack_Example' do
pod 'EncryptedDATAStack', :path => '../'
pod 'DATASource’, '~> 6.1.5'
pod 'DATASource’, '~> 7.0.2'
pod 'EncryptedCoreData', :git => 'https://github.com/project-imas/encrypted-core-data.git'

target 'EncryptedDATAStack_Tests' do
Expand Down
14 changes: 7 additions & 7 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- DATASource (6.1.5)
- DATASource (7.0.2)
- EncryptedCoreData (3.1):
- SQLCipher (~> 3.4.0)
- EncryptedDATAStack (7.0.3):
- EncryptedDATAStack (8.0.0):
- EncryptedCoreData (~> 3.1)
- SQLCipher (3.4.0):
- SQLCipher/standard (= 3.4.0)
Expand All @@ -11,7 +11,7 @@ PODS:
- SQLCipher/common

DEPENDENCIES:
- DATASource (~> 6.1.5)
- DATASource (~> 7.0.2)
- EncryptedCoreData (from `https://github.com/project-imas/encrypted-core-data.git`)
- EncryptedDATAStack (from `../`)

Expand All @@ -27,11 +27,11 @@ CHECKOUT OPTIONS:
:git: https://github.com/project-imas/encrypted-core-data.git

SPEC CHECKSUMS:
DATASource: 52b86cfff6c7ac3db45192c01f7839c7473576c3
DATASource: b86db74542b5b27d4d2af43ae698022f19507379
EncryptedCoreData: f6762fb05f88a52f36c5648659abc91b57f244b4
EncryptedDATAStack: 84897982fa1826a44a0306af5890cd786c43b4b1
EncryptedDATAStack: 943692152c4f8fc14599889e3241df2b1adcda42
SQLCipher: 4c768761421736a247ed6cf412d9045615d53dff

PODFILE CHECKSUM: eb0fd5215d30babaff403c4078e4c632c9c0447c
PODFILE CHECKSUM: 55038812cfd8a5894651392d2aa10be95b957f3b

COCOAPODS: 1.3.1
COCOAPODS: 1.4.0
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# EncryptedDATAStack
[![](http://img.shields.io/badge/iOS-8.0%2B-blue.svg)]()
[![](http://img.shields.io/badge/Swift-3-red.svg)]()
[![](http://img.shields.io/badge/Swift-4-red.svg)]()
[![CI Status](http://img.shields.io/travis/flipacholas/EncryptedDATAStack.svg?style=flat)](https://travis-ci.org/flipacholas/EncryptedDATAStack)
[![Version](https://img.shields.io/cocoapods/v/EncryptedDATAStack.svg?style=flat)](http://cocoapods.org/pods/EncryptedDATAStack)
[![License](https://img.shields.io/cocoapods/l/EncryptedDATAStack.svg?style=flat)](http://cocoapods.org/pods/EncryptedDATAStack)
[![Platform](https://img.shields.io/cocoapods/p/EncryptedDATAStack.svg?style=flat)](http://cocoapods.org/pods/EncryptedDATAStack)

Set up an encrypted Database with only 1 line of code!

**EncryptedDATAStack** is an fork of [DATAStack](https://github.com/SyncDB/DATAStack) with added support of [Encrypted Core Data](https://github.com/project-imas/encrypted-core-data) (Core Data + SQLCipher) and extra legacy support for iOS 8.
**EncryptedDATAStack** is an fork of [DATAStack](https://github.com/SyncDB/DATAStack) with added support of [Encrypted Core Data](https://github.com/project-imas/encrypted-core-data) (Core Data + SQLCipher) and extra legacy support for iOS 9.
All in all, this allows you to set up a database (encrypted and/or unencrypted) with only one line of code!

Version tags are set to match the version of DATAStack used.
Expand Down