Skip to content

Commit d7ba63e

Browse files
committed
Update playgrounds
1 parent a3ad717 commit d7ba63e

File tree

1 file changed

+14
-0
lines changed
  • ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage

1 file changed

+14
-0
lines changed

ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage/Contents.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ do {
7272
print(error)
7373
}
7474

75+
//: Query all scores who have a name.
76+
let query1 = GameScore.query(notNull(key: "name"))
77+
let results1 = try query1.find()
78+
results1.forEach { score in
79+
print("Found score with a name: \(score)")
80+
}
81+
7582
//: You can also remove a value for a property using unset.
7683
let unsetOperation = savedScore
7784
.operation.unset(("points", \.points))
@@ -93,6 +100,13 @@ do {
93100
print(error)
94101
}
95102

103+
//: Query synchronously (not preferred - all operations on main queue).
104+
let query2 = GameScore.query(isNull(key: "name"))
105+
let results2 = try query2.find()
106+
results2.forEach { score in
107+
print("Found score with name is null: \(score)")
108+
}
109+
96110
//: There are other operations: set/forceSet/unset/add/remove, etc. objects from `ParseObject`s.
97111
//: In fact, the `users` and `roles` relations from `ParseRoles` used the add/remove operations.
98112
//: Multiple operations can be chained together. See:

0 commit comments

Comments
 (0)