Skip to content

Commit db0fdea

Browse files
authored
Add findAll query (#118)
* Add findAll to query * add testcases * Allow deletion of Objc Keychain * Add relative query playground example * Simplify findAll in playgrounds * Update includeAll documentation
1 parent 1d3d1d6 commit db0fdea

File tree

19 files changed

+420
-60
lines changed

19 files changed

+420
-60
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# Parse-Swift Changelog
22

33
### main
4-
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.3.0...main)
4+
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.3.1...main)
55
* _Contributing to this repo? Add info about your change here to be included in the next release_
66

7+
### 1.3.1
8+
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.3.0...1.3.1)
9+
710
__New features__
11+
- Add findAll query to find all objects ([#118](https://github.com/parse-community/Parse-Swift/pull/118)), thanks to [Corey Baker](https://github.com/cbaker6).
12+
- Can now delete the iOS Objective-C SDK Keychain from app ([#118](https://github.com/parse-community/Parse-Swift/pull/118)), thanks to [Corey Baker](https://github.com/cbaker6).
813
- Migrate installationId from obj-c SDK ([#117](https://github.com/parse-community/Parse-Swift/pull/117)), thanks to [Corey Baker](https://github.com/cbaker6).
914

1015
__Improvements__

ParseSwift.playground/Pages/2 - Finding Objects.xcplaygroundpage/Contents.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ query.first { results in
8484
}
8585
}
8686

87+
//: Query based on relative time. Have to be using mongoDB.
88+
let queryRelative = GameScore.query(relative(key: "createdAt",
89+
comparator: .lessThan,
90+
time: "10 minutes ago"))
91+
queryRelative.find { results in
92+
switch results {
93+
case .success(let scores):
94+
95+
print("Found scores using relative time: \(scores)")
96+
97+
case .failure(let error):
98+
assertionFailure("Error querying: \(error)")
99+
}
100+
}
101+
87102
let querySelect = query.select("score")
88103
querySelect.first { results in
89104
switch results {

ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,17 @@ query7.find { results in
173173
}
174174
}
175175

176+
//: Find all GameScores.
177+
let query8 = GameScore.query()
178+
query8.findAll { result in
179+
switch result {
180+
case .success(let scores):
181+
print(scores)
182+
case .failure(let error):
183+
print(error.localizedDescription)
184+
}
185+
}
186+
176187
//: Explain the previous query.
177188
let explain: AnyDecodable = try query2.first(explain: true)
178189
print(explain)

ParseSwift.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ParseSwift"
3-
s.version = "1.3.0"
3+
s.version = "1.3.1"
44
s.summary = "Parse Pure Swift SDK"
55
s.homepage = "https://github.com/parse-community/Parse-Swift"
66
s.authors = {

ParseSwift.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,7 @@
23292329
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
23302330
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
23312331
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2332-
MARKETING_VERSION = 1.3.0;
2332+
MARKETING_VERSION = 1.3.1;
23332333
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
23342334
PRODUCT_NAME = ParseSwift;
23352335
SKIP_INSTALL = YES;
@@ -2353,7 +2353,7 @@
23532353
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
23542354
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
23552355
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2356-
MARKETING_VERSION = 1.3.0;
2356+
MARKETING_VERSION = 1.3.1;
23572357
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
23582358
PRODUCT_NAME = ParseSwift;
23592359
SKIP_INSTALL = YES;
@@ -2419,7 +2419,7 @@
24192419
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
24202420
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
24212421
MACOSX_DEPLOYMENT_TARGET = 10.13;
2422-
MARKETING_VERSION = 1.3.0;
2422+
MARKETING_VERSION = 1.3.1;
24232423
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
24242424
PRODUCT_NAME = ParseSwift;
24252425
SDKROOT = macosx;
@@ -2445,7 +2445,7 @@
24452445
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
24462446
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
24472447
MACOSX_DEPLOYMENT_TARGET = 10.13;
2448-
MARKETING_VERSION = 1.3.0;
2448+
MARKETING_VERSION = 1.3.1;
24492449
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
24502450
PRODUCT_NAME = ParseSwift;
24512451
SDKROOT = macosx;
@@ -2592,7 +2592,7 @@
25922592
INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist";
25932593
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
25942594
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2595-
MARKETING_VERSION = 1.3.0;
2595+
MARKETING_VERSION = 1.3.1;
25962596
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
25972597
MTL_FAST_MATH = YES;
25982598
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS";
@@ -2621,7 +2621,7 @@
26212621
INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist";
26222622
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
26232623
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2624-
MARKETING_VERSION = 1.3.0;
2624+
MARKETING_VERSION = 1.3.1;
26252625
MTL_FAST_MATH = YES;
26262626
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS";
26272627
PRODUCT_NAME = ParseSwift;
@@ -2648,7 +2648,7 @@
26482648
INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist";
26492649
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
26502650
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2651-
MARKETING_VERSION = 1.3.0;
2651+
MARKETING_VERSION = 1.3.1;
26522652
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
26532653
MTL_FAST_MATH = YES;
26542654
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS";
@@ -2676,7 +2676,7 @@
26762676
INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist";
26772677
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
26782678
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2679-
MARKETING_VERSION = 1.3.0;
2679+
MARKETING_VERSION = 1.3.1;
26802680
MTL_FAST_MATH = YES;
26812681
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS";
26822682
PRODUCT_NAME = ParseSwift;

Scripts/jazzy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ bundle exec jazzy \
55
--author_url http://parseplatform.org \
66
--github_url https://github.com/parse-community/Parse-Swift \
77
--root-url http://parseplatform.org/Parse-Swift/api/ \
8-
--module-version 1.3.0 \
8+
--module-version 1.3.1 \
99
--theme fullwidth \
1010
--skip-undocumented \
1111
--output ./docs/api \

Sources/ParseSwift/Objects/ParseInstallation+combine.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public extension Sequence where Element: ParseInstallation {
8888

8989
/**
9090
Saves a collection of installations *asynchronously* and publishes when complete.
91-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
91+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
9292
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
9393
Defaults to 50.
9494
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
@@ -113,7 +113,7 @@ public extension Sequence where Element: ParseInstallation {
113113

114114
/**
115115
Deletes a collection of installations *asynchronously* and publishes when complete.
116-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
116+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
117117
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
118118
Defaults to 50.
119119
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that

Sources/ParseSwift/Objects/ParseInstallation.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ public extension Sequence where Element: ParseInstallation {
637637

638638
/**
639639
Saves a collection of installations *synchronously* all at once and throws an error if necessary.
640-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
640+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
641641
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
642642
Defaults to 50.
643643
- parameter options: A set of header options sent to the server. Defaults to an empty set.
@@ -721,7 +721,7 @@ public extension Sequence where Element: ParseInstallation {
721721

722722
/**
723723
Saves a collection of installations all at once *asynchronously* and executes the completion block when done.
724-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
724+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
725725
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
726726
Defaults to 50.
727727
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
@@ -742,8 +742,12 @@ public extension Sequence where Element: ParseInstallation {
742742
callbackQueue: DispatchQueue = .main,
743743
completion: @escaping (Result<[(Result<Element, ParseError>)], ParseError>) -> Void
744744
) {
745-
let queue = DispatchQueue(label: "com.parse.saveAll", qos: .default,
746-
attributes: .concurrent, autoreleaseFrequency: .inherit, target: nil)
745+
let uuid = UUID()
746+
let queue = DispatchQueue(label: "com.parse.saveAll.\(uuid)",
747+
qos: .default,
748+
attributes: .concurrent,
749+
autoreleaseFrequency: .inherit,
750+
target: nil)
747751
queue.sync {
748752
var childObjects = [String: PointerType]()
749753
var childFiles = [UUID: ParseFile]()
@@ -947,7 +951,7 @@ public extension Sequence where Element: ParseInstallation {
947951

948952
/**
949953
Deletes a collection of installations *synchronously* all at once and throws an error if necessary.
950-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
954+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
951955
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
952956
Defaults to 50.
953957
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
@@ -994,7 +998,7 @@ public extension Sequence where Element: ParseInstallation {
994998

995999
/**
9961000
Deletes a collection of installations all at once *asynchronously* and executes the completion block when done.
997-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
1001+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
9981002
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
9991003
Defaults to 50.
10001004
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that

Sources/ParseSwift/Objects/ParseObject+combine.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public extension Sequence where Element: ParseObject {
8585

8686
/**
8787
Saves a collection of objects *asynchronously* and publishes when complete.
88-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
88+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
8989
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
9090
Defaults to 50.
9191
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
@@ -110,7 +110,7 @@ public extension Sequence where Element: ParseObject {
110110

111111
/**
112112
Deletes a collection of objects *asynchronously* and publishes when complete.
113-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
113+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
114114
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
115115
Defaults to 50.
116116
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that

Sources/ParseSwift/Objects/ParseObject.swift

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public extension Sequence where Element: ParseObject {
6161

6262
/**
6363
Saves a collection of objects *synchronously* all at once and throws an error if necessary.
64-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
64+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
6565
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
6666
Defaults to 50.
6767
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
@@ -126,7 +126,7 @@ public extension Sequence where Element: ParseObject {
126126
if transaction {
127127
batchLimit = commands.count
128128
} else {
129-
batchLimit = limit != nil ? limit! : ParseConstants.batchLimit
129+
batchLimit = limit ?? ParseConstants.batchLimit
130130
}
131131
let batches = BatchUtils.splitArray(commands, valuesPerSegment: batchLimit)
132132
try batches.forEach {
@@ -143,7 +143,7 @@ public extension Sequence where Element: ParseObject {
143143

144144
/**
145145
Saves a collection of objects all at once *asynchronously* and executes the completion block when done.
146-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
146+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
147147
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
148148
Defaults to 50.
149149
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
@@ -163,8 +163,12 @@ public extension Sequence where Element: ParseObject {
163163
callbackQueue: DispatchQueue = .main,
164164
completion: @escaping (Result<[(Result<Element, ParseError>)], ParseError>) -> Void
165165
) {
166-
let queue = DispatchQueue(label: "com.parse.saveAll", qos: .default,
167-
attributes: .concurrent, autoreleaseFrequency: .inherit, target: nil)
166+
let uuid = UUID()
167+
let queue = DispatchQueue(label: "com.parse.saveAll.\(uuid)",
168+
qos: .default,
169+
attributes: .concurrent,
170+
autoreleaseFrequency: .inherit,
171+
target: nil)
168172
queue.sync {
169173

170174
var childObjects = [String: PointerType]()
@@ -220,7 +224,7 @@ public extension Sequence where Element: ParseObject {
220224
if transaction {
221225
batchLimit = commands.count
222226
} else {
223-
batchLimit = limit != nil ? limit! : ParseConstants.batchLimit
227+
batchLimit = limit ?? ParseConstants.batchLimit
224228
}
225229
let batches = BatchUtils.splitArray(commands, valuesPerSegment: batchLimit)
226230
var completed = 0
@@ -361,7 +365,7 @@ public extension Sequence where Element: ParseObject {
361365

362366
/**
363367
Deletes a collection of objects *synchronously* all at once and throws an error if necessary.
364-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
368+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
365369
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
366370
Defaults to 50.
367371
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
@@ -390,7 +394,7 @@ public extension Sequence where Element: ParseObject {
390394
if transaction {
391395
batchLimit = commands.count
392396
} else {
393-
batchLimit = limit != nil ? limit! : ParseConstants.batchLimit
397+
batchLimit = limit ?? ParseConstants.batchLimit
394398
}
395399
let batches = BatchUtils.splitArray(commands, valuesPerSegment: batchLimit)
396400
try batches.forEach {
@@ -404,7 +408,7 @@ public extension Sequence where Element: ParseObject {
404408

405409
/**
406410
Deletes a collection of objects all at once *asynchronously* and executes the completion block when done.
407-
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched
411+
- parameter batchLimit: The maximum number of objects to send in each batch. If the items to be batched.
408412
is greater than the `batchLimit`, the objects will be sent to the server in waves up to the `batchLimit`.
409413
Defaults to 50.
410414
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
@@ -439,7 +443,7 @@ public extension Sequence where Element: ParseObject {
439443
if transaction {
440444
batchLimit = commands.count
441445
} else {
442-
batchLimit = limit != nil ? limit! : ParseConstants.batchLimit
446+
batchLimit = limit ?? ParseConstants.batchLimit
443447
}
444448
let batches = BatchUtils.splitArray(commands, valuesPerSegment: batchLimit)
445449
var completed = 0
@@ -633,9 +637,12 @@ extension ParseObject {
633637
internal func ensureDeepSave(options: API.Options = [],
634638
completion: @escaping ([String: PointerType],
635639
[UUID: ParseFile], ParseError?) -> Void) {
636-
637-
let queue = DispatchQueue(label: "com.parse.deepSave", qos: .default,
638-
attributes: .concurrent, autoreleaseFrequency: .inherit, target: nil)
640+
let uuid = UUID()
641+
let queue = DispatchQueue(label: "com.parse.deepSave.\(uuid)",
642+
qos: .default,
643+
attributes: .concurrent,
644+
autoreleaseFrequency: .inherit,
645+
target: nil)
639646

640647
queue.sync {
641648
var objectsFinishedSaving = [String: PointerType]()

0 commit comments

Comments
 (0)