My User object has a field of “blockedUsers” which in the ParseDatabase is a relation to _User.
Unfortunately, I’m getting an error of
Value type ‘User’ cannot have a stored property that recursively contains it
my User object:
struct User: ParseUser {
//: These are required for `ParseObject`.
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
//: These are required for `ParseUser`.
var username: String?
var email: String?
var emailVerified: Bool?
var password: String?
var authData: [String: [String: String]?]?
//: Your custom keys.
var role: Role<User>
var userProfile: UserProfile?
var userSettings: UserSettings?
var blockedUsers: ParseRelation<User> [ERROR HERE]
}
Is there a way around this or should I go store the user objectId in an array instead?
I’m still confused on how I would query the data from this relation
let relation = User.current!.relation
if my key is blockedUsers. and I’ve added the user via
relation.add("blockedUsers", UserObject)
How would I actually get the relation later on when I need to find the blockedUsers?
The examples on the documentation link you sent is all about ParseRoles and it kinda confuses me.
Do I
do {
try relation.query().find { result in
switch result {
case .success(let relatedUsers):
print(“success”)
case .failure(let error):
print(“fail”)
}
}
} catch {
print(error)
}
Basically I don’t see where I can set that I want the relation of the currentUser’s blockedUsers when I query.