From 346dd235ab02782c95c2b9299e521d02a731396a Mon Sep 17 00:00:00 2001 From: Vanderlei Martinelli Date: Tue, 18 Oct 2016 17:16:47 -0200 Subject: [PATCH 1/2] Minor change --- Source/AlecrimCoreData/Core/Protocols/TableProtocol.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/AlecrimCoreData/Core/Protocols/TableProtocol.swift b/Source/AlecrimCoreData/Core/Protocols/TableProtocol.swift index 7a2173d..95a5a77 100644 --- a/Source/AlecrimCoreData/Core/Protocols/TableProtocol.swift +++ b/Source/AlecrimCoreData/Core/Protocols/TableProtocol.swift @@ -49,7 +49,7 @@ extension TableProtocol { objectIDs = try fetchRequest.execute() } else { - objectIDs = try! self.context.fetch(fetchRequest) + objectIDs = try self.context.fetch(fetchRequest) } for objectID in objectIDs { From af4529292d13bd146e694e8d64f067185ae895bb Mon Sep 17 00:00:00 2001 From: Vanderlei Martinelli Date: Tue, 18 Oct 2016 17:24:28 -0200 Subject: [PATCH 2/2] Minor changes --- .../Core/Protocols/CoreDataQueryable.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/AlecrimCoreData/Core/Protocols/CoreDataQueryable.swift b/Source/AlecrimCoreData/Core/Protocols/CoreDataQueryable.swift index d2f0e82..1c506b0 100644 --- a/Source/AlecrimCoreData/Core/Protocols/CoreDataQueryable.swift +++ b/Source/AlecrimCoreData/Core/Protocols/CoreDataQueryable.swift @@ -50,31 +50,31 @@ extension CoreDataQueryable { public final func sum(_ closure: (Self.Element.Type) -> Attribute) -> U { let attribute = closure(Self.Element.self) - return self.aggregate(using: "sum", attribute: attribute) + return self.aggregate(withFunctionName: "sum", attribute: attribute) } public final func min(_ closure: (Self.Element.Type) -> Attribute) -> U { let attribute = closure(Self.Element.self) - return self.aggregate(using: "min", attribute: attribute) + return self.aggregate(withFunctionName: "min", attribute: attribute) } public final func max(_ closure: (Self.Element.Type) -> Attribute) -> U { let attribute = closure(Self.Element.self) - return self.aggregate(using: "max", attribute: attribute) + return self.aggregate(withFunctionName: "max", attribute: attribute) } // same as average, for convenience public final func avg(_ closure: (Self.Element.Type) -> Attribute) -> U { let attribute = closure(Self.Element.self) - return self.aggregate(using: "average", attribute: attribute) + return self.aggregate(withFunctionName: "average", attribute: attribute) } public final func average(_ closure: (Self.Element.Type) -> Attribute) -> U { let attribute = closure(Self.Element.self) - return self.aggregate(using: "average", attribute: attribute) + return self.aggregate(withFunctionName: "average", attribute: attribute) } - private final func aggregate(using functionName: String, attribute: Attribute) -> U { + private final func aggregate(withFunctionName functionName: String, attribute: Attribute) -> U { let attributeDescription = self.entityDescription.attributesByName[attribute.___name]! let keyPathExpression = NSExpression(forKeyPath: attribute.___name)