I'm using Parse object store in my iOS application and I've created a custom subclass for my Parse object, which looks somewhat like this:
class MyThing: PFObject, PFSubclassing {
// ...PFSubclassing protocol...
@NSManaged var name: String
@NSManaged var somethingElse: String
@NSManaged var relatedThings: PFRelation
}
The relatedThings
property works: I am able to fetch the related objects from the store. However, I keep getting this warning from Parse:
[Warning]: PFRelation properties are always readonly,
but MyApp.MyThing.relatedThings was declared otherwise.
In Objective-C, I could have easily marked that property as readonly, but I am unsure how to do that in Swift to silence the warning.
Using let
instead of var
is not allowed in combination with @NSManaged
.
Adding private(set)
has no effect either:
@NSManaged private(set) var relatedThings: PFRelation
So how does Parse expect me to declare the relationship property?
Now you should use:
var relatedThings: PFRelation! {
return relationForKey("relatedThings")
}