Compare commits

..

13 Commits
2.0.0 ... 2.0.5

Author SHA1 Message Date
John Rommel Estropia
4a34012d58 version bump 2016-09-08 00:40:58 +09:00
John Estropia
45690a29c6 Merge pull request #92 from ThibaultVlacich/develop
Add DEBUG flag to the Debug config
2016-09-07 19:01:19 +09:00
Thibault Vlacich
0d4d036a86 Add DEBUG flag to the Debug config 2016-09-07 10:43:43 +02:00
John Estropia
ed0fdc76fe update podspec 2016-09-06 11:19:38 +09:00
John Estropia
58f4907575 Prevent retain cycles in NSManagedObjectContext (fixes #87) 2016-09-06 11:13:16 +09:00
John Rommel Estropia
1950224863 version bump 2016-07-22 00:33:15 +09:00
John Rommel Estropia
f0cd288657 allow querying on relationship attributes (fixes #83) 2016-07-22 00:29:48 +09:00
John Estropia
3344e42d7c version bump 2016-07-21 11:51:57 +09:00
John Estropia
e4b6c06401 fixed internal errors getting thrown as .Unknown instead of .InternalError (fixes #84) 2016-07-21 11:51:49 +09:00
John Estropia
7fc3ad2890 Tidy up, version bump 2016-07-14 19:59:15 +09:00
John Estropia
556f6d13b3 Merge pull request #81 from jannon/mark-app-extension-safe
Mark app extension safe
2016-07-14 19:41:55 +09:00
Jannon Frank
a088fe3817 mark iOS and tvOS safe for app extensions 2016-07-12 18:39:23 -07:00
Jannon Frank
c4391a8d0c Merge remote-tracking branch 'JohnEstropia/master' into upstream 2016-07-12 18:36:53 -07:00
11 changed files with 63 additions and 37 deletions

View File

@@ -1 +1 @@
github "JohnEstropia/GCDKit" == 1.2.5
github "JohnEstropia/GCDKit" == 1.2.6

View File

@@ -1 +1 @@
github "JohnEstropia/GCDKit" "1.2.4"
github "JohnEstropia/GCDKit" "1.2.6"

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CoreStore"
s.version = "2.0.0"
s.version = "2.0.5"
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"
@@ -16,8 +16,9 @@ Pod::Spec.new do |s|
s.public_header_files = "Sources/**/*.h"
s.frameworks = "Foundation", "CoreData"
s.requires_arc = true
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS',
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS[config=Debug]' => '-D USE_FRAMEWORKS -D DEBUG',
'OTHER_SWIFT_FLAGS[config=Release]' => '-D USE_FRAMEWORKS',
'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' }
s.dependency "GCDKit", "1.2.5"
end
s.dependency "GCDKit", "1.2.6"
end

View File

@@ -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;
@@ -2630,7 +2632,6 @@
B52DD1851BE1F8CD00949AFE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
@@ -2652,7 +2653,6 @@
B52DD1861BE1F8CD00949AFE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;

View File

@@ -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)

View File

@@ -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"]

View File

@@ -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."
)
}

View File

@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.0</string>
<string>2.0.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@@ -32,14 +32,10 @@ internal final class NotificationObserver {
// MARK: Public
let notificationName: String
let object: AnyObject?
let observer: NSObjectProtocol
init(notificationName: String, object: AnyObject?, queue: NSOperationQueue? = nil, closure: (note: NSNotification) -> Void) {
self.notificationName = notificationName
self.object = object
self.observer = NSNotificationCenter.defaultCenter().addObserverForName(
notificationName,
object: object,
@@ -50,10 +46,6 @@ internal final class NotificationObserver {
deinit {
NSNotificationCenter.defaultCenter().removeObserver(
self.observer,
name: self.notificationName,
object: self.object
)
NSNotificationCenter.defaultCenter().removeObserver(self.observer)
}
}

View File

@@ -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
}
}
}