mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-30 14:21:49 +02:00
Merge branch 'develop' into swift3_develop
# Conflicts: # Cartfile.resolved # Carthage/Checkouts/GCDKit # CoreStoreTests/ErrorTests.swift # Sources/Fetching and Querying/Concrete Clauses/Select.swift # Sources/ObjectiveC/CSError.swift
This commit is contained in:
2
Cartfile
2
Cartfile
@@ -1 +1 @@
|
|||||||
github "JohnEstropia/GCDKit" == 1.2.5
|
github "JohnEstropia/GCDKit" == 1.2.6
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
github "JohnEstropia/GCDKit" "1.2.5"
|
github "JohnEstropia/GCDKit" "1.2.6"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "CoreStore"
|
s.name = "CoreStore"
|
||||||
s.version = "2.0.0"
|
s.version = "2.0.3"
|
||||||
s.license = "MIT"
|
s.license = "MIT"
|
||||||
s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift"
|
s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift"
|
||||||
s.homepage = "https://github.com/JohnEstropia/CoreStore"
|
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',
|
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS',
|
||||||
'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' }
|
'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' }
|
||||||
|
|
||||||
s.dependency "GCDKit", "1.2.5"
|
s.dependency "GCDKit", "1.2.6"
|
||||||
end
|
end
|
||||||
@@ -2111,6 +2111,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
@@ -2166,6 +2167,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
@@ -2355,7 +2357,6 @@
|
|||||||
B52DD1851BE1F8CD00949AFE /* Debug */ = {
|
B52DD1851BE1F8CD00949AFE /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
@@ -2381,7 +2382,6 @@
|
|||||||
B52DD1861BE1F8CD00949AFE /* Release */ = {
|
B52DD1861BE1F8CD00949AFE /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ final class ErrorTests: XCTestCase {
|
|||||||
"key3": Date()
|
"key3": Date()
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
let error = CoreStoreError.internalError(NSError: internalError)
|
let error = CoreStoreError(internalError)
|
||||||
XCTAssertEqual((error as NSError).domain, CoreStoreErrorDomain)
|
XCTAssertEqual((error as NSError).domain, CoreStoreErrorDomain)
|
||||||
XCTAssertEqual((error as NSError).code, CoreStoreErrorCode.internalError.rawValue)
|
XCTAssertEqual((error as NSError).code, CoreStoreErrorCode.internalError.rawValue)
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ let package = Package(
|
|||||||
dependencies: [
|
dependencies: [
|
||||||
.Package(
|
.Package(
|
||||||
url: "https://github.com/JohnEstropia/GCDKit.git",
|
url: "https://github.com/JohnEstropia/GCDKit.git",
|
||||||
majorVersion: 1, minor: 2
|
"1.2.6"
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
exclude: ["Carthage", "CoreStoreDemo", "Sources/libA/images"]
|
exclude: ["Carthage", "CoreStoreDemo", "Sources/libA/images"]
|
||||||
|
|||||||
@@ -745,9 +745,28 @@ internal extension Collection where Iterator.Element == SelectTerm {
|
|||||||
fetchRequest.includesPendingChanges = false
|
fetchRequest.includesPendingChanges = false
|
||||||
fetchRequest.resultType = .dictionaryResultType
|
fetchRequest.resultType = .dictionaryResultType
|
||||||
|
|
||||||
let entityDescription = fetchRequest.entity!
|
func attributeDescriptionForKeyPath(keyPath: String, inEntity entity: NSEntityDescription) -> NSAttributeDescription? {
|
||||||
let propertiesByName = entityDescription.propertiesByName
|
|
||||||
let attributesByName = entityDescription.attributesByName
|
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]()
|
var propertiesToFetch = [AnyObject]()
|
||||||
for term in self {
|
for term in self {
|
||||||
@@ -755,20 +774,22 @@ internal extension Collection where Iterator.Element == SelectTerm {
|
|||||||
switch term {
|
switch term {
|
||||||
|
|
||||||
case ._attribute(let keyPath):
|
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 {
|
else {
|
||||||
|
|
||||||
CoreStore.log(
|
CoreStore.log(
|
||||||
.warning,
|
.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):
|
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()
|
let expressionDescription = NSExpressionDescription()
|
||||||
expressionDescription.name = alias
|
expressionDescription.name = alias
|
||||||
@@ -784,14 +805,13 @@ internal extension Collection where Iterator.Element == SelectTerm {
|
|||||||
forFunction: function,
|
forFunction: function,
|
||||||
arguments: [NSExpression(forKeyPath: keyPath)]
|
arguments: [NSExpression(forKeyPath: keyPath)]
|
||||||
)
|
)
|
||||||
|
|
||||||
propertiesToFetch.append(expressionDescription)
|
propertiesToFetch.append(expressionDescription)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
CoreStore.log(
|
CoreStore.log(
|
||||||
.warning,
|
.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."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2.0.0</string>
|
<string>2.0.3</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|||||||
@@ -248,9 +248,17 @@ internal extension ErrorProtocol {
|
|||||||
|
|
||||||
switch self {
|
switch self {
|
||||||
|
|
||||||
case let error as CoreStoreError: return error
|
case let error as CoreStoreError:
|
||||||
case let error as CSError: return error.bridgeToSwift
|
return error
|
||||||
default: return .unknown
|
|
||||||
|
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 ErrorProtocol {
|
|||||||
|
|
||||||
switch self {
|
switch self {
|
||||||
|
|
||||||
case let error as CoreStoreError: return error.bridgeToObjectiveC
|
case let error as CoreStoreError:
|
||||||
case let error as CSError: return error
|
return error.bridgeToObjectiveC
|
||||||
default: return self as NSError
|
|
||||||
|
case let error as CSError:
|
||||||
|
return error
|
||||||
|
|
||||||
|
default:
|
||||||
|
return self as NSError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user