Skip to content

Commit 00927b3

Browse files
committed
Added simple debugging support.
1 parent 9290038 commit 00927b3

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

CoreDataQueryInterface.xcodeproj/project.pbxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@
9898
F3967F081D98481E006382C6 /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3967F051D98481E006382C6 /* Query.swift */; };
9999
F3967F091D98481E006382C6 /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3967F051D98481E006382C6 /* Query.swift */; };
100100
F39C7A741B718E34008DB31C /* CoreDataQueryInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = F37C46A51B2A780200B35B1B /* CoreDataQueryInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };
101+
F3E65C911DBFEBF80063DFA5 /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E65C901DBFEBF80063DFA5 /* Debug.swift */; };
102+
F3E65C921DBFEBF80063DFA5 /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E65C901DBFEBF80063DFA5 /* Debug.swift */; };
103+
F3E65C931DBFEBF80063DFA5 /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E65C901DBFEBF80063DFA5 /* Debug.swift */; };
104+
F3E65C941DBFEBF80063DFA5 /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E65C901DBFEBF80063DFA5 /* Debug.swift */; };
101105
F3E6B5501B2BFCA500F735EE /* FilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E6B54F1B2BFCA500F735EE /* FilterTests.swift */; };
102106
F3E6B5511B2BFCA500F735EE /* FilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E6B54F1B2BFCA500F735EE /* FilterTests.swift */; };
103107
F3E6B5531B2C01CC00F735EE /* OrderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E6B5521B2C01CC00F735EE /* OrderTests.swift */; };
@@ -175,6 +179,7 @@
175179
F3967F051D98481E006382C6 /* Query.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Query.swift; sourceTree = "<group>"; };
176180
F39C7A711B718DB2008DB31C /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
177181
F3DEBD9F1B40FCCD00EE1382 /* bin */ = {isa = PBXFileReference; lastKnownFileType = folder; path = bin; sourceTree = "<group>"; };
182+
F3E65C901DBFEBF80063DFA5 /* Debug.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Debug.swift; sourceTree = "<group>"; };
178183
F3E6B54F1B2BFCA500F735EE /* FilterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FilterTests.swift; sourceTree = "<group>"; };
179184
F3E6B5521B2C01CC00F735EE /* OrderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderTests.swift; sourceTree = "<group>"; };
180185
F3F1BC531CD0020100F9072D /* CoreDataQueryInterface.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreDataQueryInterface.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -282,6 +287,7 @@
282287
F3967F001D984801006382C6 /* QueryBuilder.swift */,
283288
F3967EE21D984610006382C6 /* Types.swift */,
284289
F34169B51DA57AB00009560A /* Util.swift */,
290+
F3E65C901DBFEBF80063DFA5 /* Debug.swift */,
285291
);
286292
name = Source;
287293
sourceTree = "<group>";
@@ -623,6 +629,7 @@
623629
F3967EDA1D9844CD006382C6 /* Protocols.swift in Sources */,
624630
F3967EE91D9846C7006382C6 /* Attributes.swift in Sources */,
625631
F3967EF81D984758006382C6 /* Miscellanea.swift in Sources */,
632+
F3E65C921DBFEBF80063DFA5 /* Debug.swift in Sources */,
626633
F3F52CEF1D984CB4009D8DFB /* Predicate.swift in Sources */,
627634
F34169B71DA57AB00009560A /* Util.swift in Sources */,
628635
F3967F021D984801006382C6 /* QueryBuilder.swift in Sources */,
@@ -665,6 +672,7 @@
665672
F3967EDB1D9844CD006382C6 /* Protocols.swift in Sources */,
666673
F3967EEA1D9846C7006382C6 /* Attributes.swift in Sources */,
667674
F3967EF91D984758006382C6 /* Miscellanea.swift in Sources */,
675+
F3E65C931DBFEBF80063DFA5 /* Debug.swift in Sources */,
668676
F3F52CF01D984CB4009D8DFB /* Predicate.swift in Sources */,
669677
F34169B81DA57AB00009560A /* Util.swift in Sources */,
670678
F3967F031D984801006382C6 /* QueryBuilder.swift in Sources */,
@@ -707,6 +715,7 @@
707715
F3967ED91D9844CD006382C6 /* Protocols.swift in Sources */,
708716
F3967EE81D9846C7006382C6 /* Attributes.swift in Sources */,
709717
F3967EF71D984758006382C6 /* Miscellanea.swift in Sources */,
718+
F3E65C911DBFEBF80063DFA5 /* Debug.swift in Sources */,
710719
F3F52CEE1D984CB4009D8DFB /* Predicate.swift in Sources */,
711720
F34169B61DA57AB00009560A /* Util.swift in Sources */,
712721
F3967F011D984801006382C6 /* QueryBuilder.swift in Sources */,
@@ -749,6 +758,7 @@
749758
F3967EDC1D9844CD006382C6 /* Protocols.swift in Sources */,
750759
F3967EEB1D9846C7006382C6 /* Attributes.swift in Sources */,
751760
F3967EFA1D984758006382C6 /* Miscellanea.swift in Sources */,
761+
F3E65C941DBFEBF80063DFA5 /* Debug.swift in Sources */,
752762
F3F52CF11D984CB4009D8DFB /* Predicate.swift in Sources */,
753763
F34169B91DA57AB00009560A /* Util.swift in Sources */,
754764
F3967F041D984801006382C6 /* QueryBuilder.swift in Sources */,

CoreDataQueryInterface/Debug.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// Debug.swift
3+
// CoreDataQueryInterface
4+
//
5+
// Created by Gregory Higley on 10/25/16.
6+
// Copyright © 2016 Prosumma LLC. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
var debug: Bool = {
12+
var debug = false
13+
for arg in ProcessInfo.processInfo.arguments {
14+
if arg == "-com.prosumma.CoreDataQueryInterface.Debug" {
15+
debug = true
16+
break
17+
}
18+
}
19+
return debug
20+
}()

CoreDataQueryInterface/QueryBuilder.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Foundation
1111

1212
public struct QueryBuilder<M: NSManagedObject> {
1313
public init() {}
14+
1415
public var fetchLimit: Int = 0
1516
public var fetchOffset: Int = 0
1617
public var predicates = [NSPredicate]()
@@ -32,6 +33,9 @@ public struct QueryBuilder<M: NSManagedObject> {
3233
request.propertiesToFetch = propertiesToFetch
3334
request.propertiesToGroupBy = propertiesToGroupBy
3435
request.resultType = resultType
36+
if debug {
37+
NSLog("%@", request)
38+
}
3539
return request
3640
}
3741

0 commit comments

Comments
 (0)