We’re asking about async/await support in the Parse Apple SDK.
Upon doing research, it’s been asked, and answered with a ‘no’ but the last activity was 3+ years ago and from someone no longer involved in that edition. See here
We are finding some ambiguity in the documentation (4.1.2) but upon experimenting it does appear to work in some cases.
So posing the question: does the Parse Apple SDK support async/await, or is that relegated to the Parse-Swift branch?
If it is supported, is this a “safe” implementation? Is there something ‘better’ or another option?
Suppose we have a Person Class and want to query for all persons using await.
class PersonClass: PFObject, PFSubclassing {
@NSManaged var name: String
@NSManaged var age: Int
static func parseClassName() -> String {
return "PersonClass"
}
}
and the query
Task {
let query = PersonClass.query()
if let results = try await query?.findObjectsInBackground() as? [PersonClass] {
results.forEach { person in
print(person.name, person.age)
}
} else {
print("no persons found")
}
}