From a088fe381728c1390c39b1cb995aa8f5448de6ab Mon Sep 17 00:00:00 2001 From: Jannon Frank Date: Tue, 12 Jul 2016 18:39:23 -0700 Subject: [PATCH 1/6] mark iOS and tvOS safe for app extensions --- CoreStore.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CoreStore.xcodeproj/project.pbxproj b/CoreStore.xcodeproj/project.pbxproj index 2fc29e6..2a4acb3 100644 --- a/CoreStore.xcodeproj/project.pbxproj +++ b/CoreStore.xcodeproj/project.pbxproj @@ -2501,6 +2501,7 @@ 2F03A54419C5C6DA005002A5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2517,6 +2518,7 @@ 2F03A54519C5C6DA005002A5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2563,6 +2565,7 @@ 82BA189A1C4BBCBA00A0916E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2581,6 +2584,7 @@ 82BA189B1C4BBCBA00A0916E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; From 7fc3ad2890151bf3e9071d2eab793e316c5aab9c Mon Sep 17 00:00:00 2001 From: John Estropia Date: Thu, 14 Jul 2016 19:59:15 +0900 Subject: [PATCH 2/6] Tidy up, version bump --- Cartfile | 2 +- Cartfile.resolved | 2 +- Carthage/Checkouts/GCDKit | 2 +- CoreStore.podspec | 4 ++-- CoreStore.xcodeproj/project.pbxproj | 8 ++------ Package.swift | 2 +- Sources/Info.plist | 2 +- 7 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Cartfile b/Cartfile index 4f4c0f2..b322e93 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "JohnEstropia/GCDKit" == 1.2.5 +github "JohnEstropia/GCDKit" == 1.2.6 diff --git a/Cartfile.resolved b/Cartfile.resolved index 13b3aef..86ed4b6 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1 @@ -github "JohnEstropia/GCDKit" "1.2.4" +github "JohnEstropia/GCDKit" "1.2.6" diff --git a/Carthage/Checkouts/GCDKit b/Carthage/Checkouts/GCDKit index 90d4f31..bef1b10 160000 --- a/Carthage/Checkouts/GCDKit +++ b/Carthage/Checkouts/GCDKit @@ -1 +1 @@ -Subproject commit 90d4f31f63a1c98bf7090381c844c62d73a4c8eb +Subproject commit bef1b1075f718bc6ebd9d9a7abf2de5b39afda2d diff --git a/CoreStore.podspec b/CoreStore.podspec index 4044620..f3cde12 100644 --- a/CoreStore.podspec +++ b/CoreStore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CoreStore" - s.version = "2.0.0" + s.version = "2.0.1" s.license = "MIT" s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift" s.homepage = "https://github.com/JohnEstropia/CoreStore" @@ -19,5 +19,5 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS', 'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' } - s.dependency "GCDKit", "1.2.5" + s.dependency "GCDKit", "1.2.6" end \ No newline at end of file diff --git a/CoreStore.xcodeproj/project.pbxproj b/CoreStore.xcodeproj/project.pbxproj index 2a4acb3..edc705f 100644 --- a/CoreStore.xcodeproj/project.pbxproj +++ b/CoreStore.xcodeproj/project.pbxproj @@ -2398,6 +2398,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -2453,6 +2454,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -2501,7 +2503,6 @@ 2F03A54419C5C6DA005002A5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2518,7 +2519,6 @@ 2F03A54519C5C6DA005002A5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2565,7 +2565,6 @@ 82BA189A1C4BBCBA00A0916E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2584,7 +2583,6 @@ 82BA189B1C4BBCBA00A0916E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2634,7 +2632,6 @@ B52DD1851BE1F8CD00949AFE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; @@ -2656,7 +2653,6 @@ B52DD1861BE1F8CD00949AFE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; diff --git a/Package.swift b/Package.swift index a0d5c0d..0ab361a 100644 --- a/Package.swift +++ b/Package.swift @@ -44,7 +44,7 @@ let package = Package( dependencies: [ .Package( url: "https://github.com/JohnEstropia/GCDKit.git", - majorVersion: 1, minor: 2 + "1.2.6" ) ], exclude: ["Carthage", "CoreStoreDemo", "Sources/libA/images"] diff --git a/Sources/Info.plist b/Sources/Info.plist index 7e7479f..783e22e 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0.0 + 2.0.1 CFBundleSignature ???? CFBundleVersion From e4b6c064013c7665757503bec6ea0ee434676cb0 Mon Sep 17 00:00:00 2001 From: John Estropia Date: Thu, 21 Jul 2016 11:51:49 +0900 Subject: [PATCH 3/6] fixed internal errors getting thrown as .Unknown instead of .InternalError (fixes #84) --- CoreStoreTests/ErrorTests.swift | 2 +- Sources/ObjectiveC/CSError.swift | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CoreStoreTests/ErrorTests.swift b/CoreStoreTests/ErrorTests.swift index 7276015..006d430 100644 --- a/CoreStoreTests/ErrorTests.swift +++ b/CoreStoreTests/ErrorTests.swift @@ -147,7 +147,7 @@ final class ErrorTests: XCTestCase { "key3": NSDate() ] ) - let error = CoreStoreError.InternalError(NSError: internalError) + let error = CoreStoreError(internalError) XCTAssertEqual((error as NSError).domain, CoreStoreErrorDomain) XCTAssertEqual((error as NSError).code, CoreStoreErrorCode.InternalError.rawValue) diff --git a/Sources/ObjectiveC/CSError.swift b/Sources/ObjectiveC/CSError.swift index 45f7587..4ae96f5 100644 --- a/Sources/ObjectiveC/CSError.swift +++ b/Sources/ObjectiveC/CSError.swift @@ -248,9 +248,17 @@ internal extension ErrorType { switch self { - case let error as CoreStoreError: return error - case let error as CSError: return error.bridgeToSwift - default: return .Unknown + case let error as CoreStoreError: + return error + + case let error as CSError: + return error.bridgeToSwift + + case let error as NSError where self.dynamicType is NSError.Type: + return .InternalError(NSError: error) + + default: + return .Unknown } } @@ -258,9 +266,14 @@ internal extension ErrorType { switch self { - case let error as CoreStoreError: return error.bridgeToObjectiveC - case let error as CSError: return error - default: return self as NSError + case let error as CoreStoreError: + return error.bridgeToObjectiveC + + case let error as CSError: + return error + + default: + return self as NSError } } } From 3344e42d7c5d005daaa9b1fc6e886346d89cf68c Mon Sep 17 00:00:00 2001 From: John Estropia Date: Thu, 21 Jul 2016 11:51:57 +0900 Subject: [PATCH 4/6] version bump --- CoreStore.podspec | 2 +- Sources/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CoreStore.podspec b/CoreStore.podspec index f3cde12..401f581 100644 --- a/CoreStore.podspec +++ b/CoreStore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CoreStore" - s.version = "2.0.1" + s.version = "2.0.2" s.license = "MIT" s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift" s.homepage = "https://github.com/JohnEstropia/CoreStore" diff --git a/Sources/Info.plist b/Sources/Info.plist index 783e22e..a16c895 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0.1 + 2.0.2 CFBundleSignature ???? CFBundleVersion From f0cd2886573adcb93d072581f20084b28f524d68 Mon Sep 17 00:00:00 2001 From: John Rommel Estropia Date: Fri, 22 Jul 2016 00:29:48 +0900 Subject: [PATCH 5/6] allow querying on relationship attributes (fixes #83) --- .../Concrete Clauses/Select.swift | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/Sources/Fetching and Querying/Concrete Clauses/Select.swift b/Sources/Fetching and Querying/Concrete Clauses/Select.swift index efda950..040e8ce 100644 --- a/Sources/Fetching and Querying/Concrete Clauses/Select.swift +++ b/Sources/Fetching and Querying/Concrete Clauses/Select.swift @@ -715,9 +715,28 @@ internal extension CollectionType where Generator.Element == SelectTerm { fetchRequest.includesPendingChanges = false fetchRequest.resultType = .DictionaryResultType - let entityDescription = fetchRequest.entity! - let propertiesByName = entityDescription.propertiesByName - let attributesByName = entityDescription.attributesByName + func attributeDescriptionForKeyPath(keyPath: String, inEntity entity: NSEntityDescription) -> NSAttributeDescription? { + + let components = keyPath.componentsSeparatedByString(".") + switch components.count { + + case 0: + return nil + + case 1: + return entity.attributesByName[components[0]] + + default: + guard let relationship = entity.relationshipsByName[components[0]] else { + + return nil + } + return attributeDescriptionForKeyPath( + components.dropFirst().joinWithSeparator("."), + inEntity: relationship.entity + ) + } + } var propertiesToFetch = [AnyObject]() for term in self { @@ -725,20 +744,22 @@ internal extension CollectionType where Generator.Element == SelectTerm { switch term { case ._Attribute(let keyPath): - if let propertyDescription = propertiesByName[keyPath] { + let entityDescription = fetchRequest.entity! + if let attributeDescription = attributeDescriptionForKeyPath(keyPath, inEntity: entityDescription) { - propertiesToFetch.append(propertyDescription) + propertiesToFetch.append(attributeDescription) } else { CoreStore.log( .Warning, - message: "The property \"\(keyPath)\" does not exist in entity \(cs_typeName(entityDescription.managedObjectClassName)) and will be ignored by \(cs_typeName(owner)) query clause." + message: "The key path \"\(keyPath)\" could not be resolved in entity \(cs_typeName(entityDescription.managedObjectClassName)) as an attribute and will be ignored by \(cs_typeName(owner)) query clause." ) } case ._Aggregate(let function, let keyPath, let alias, let nativeType): - if let attributeDescription = attributesByName[keyPath] { + let entityDescription = fetchRequest.entity! + if let attributeDescription = attributeDescriptionForKeyPath(keyPath, inEntity: entityDescription) { let expressionDescription = NSExpressionDescription() expressionDescription.name = alias @@ -754,14 +775,13 @@ internal extension CollectionType where Generator.Element == SelectTerm { forFunction: function, arguments: [NSExpression(forKeyPath: keyPath)] ) - propertiesToFetch.append(expressionDescription) } else { CoreStore.log( .Warning, - message: "The attribute \"\(keyPath)\" does not exist in entity \(cs_typeName(entityDescription.managedObjectClassName)) and will be ignored by \(cs_typeName(owner)) query clause." + message: "The key path \"\(keyPath)\" could not be resolved in entity \(cs_typeName(entityDescription.managedObjectClassName)) as an attribute and will be ignored by \(cs_typeName(owner)) query clause." ) } From 19502248634bc0b1ecef5cf2f674d75c98066687 Mon Sep 17 00:00:00 2001 From: John Rommel Estropia Date: Fri, 22 Jul 2016 00:33:15 +0900 Subject: [PATCH 6/6] version bump --- CoreStore.podspec | 2 +- Sources/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CoreStore.podspec b/CoreStore.podspec index 401f581..dd137c4 100644 --- a/CoreStore.podspec +++ b/CoreStore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CoreStore" - s.version = "2.0.2" + s.version = "2.0.3" s.license = "MIT" s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift" s.homepage = "https://github.com/JohnEstropia/CoreStore" diff --git a/Sources/Info.plist b/Sources/Info.plist index a16c895..0de69c1 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0.2 + 2.0.3 CFBundleSignature ???? CFBundleVersion