I have subclassed PFUser and added a property isManager
class User : PFUser, PFSubclassing {
@NSManaged var isManager: Bool
override class func load() {
self.registerSubclass()
}
}
I tried
user.isManager = false
but get the run time error
[Foo.User setIsManager:]: unrecognized selector sent to instance 0x145bf550
I also tried using NSNumber because of core data
user.isManager = NSNumber(bool: false)
but get the compile time error
NSNumber is not convertible to bool
I've actually found it to be much simpler to implement "get" and "set".
class User: PFUser, PFSubclassing {
var isManager: Bool {
get { return self["isManager"] as! Bool }
set { self["isManager"] = newValue }
}
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With