Subclassing PFObject in Swift
ios, parse-platform, subclassing, swift
Solution
I had this same problem. Had to add @NSManaged to the properties I wanted saved:
class Armor : PFObject, PFSubclassing {
@NSManaged var displayName: String
class func parseClassName() -> String! {
return "Armor"
}
}
var armor = Armor.object()
armor.displayName = "Iron Clad"
Hopefully this is resolved in the next update.
Problem
The Parse documentation for adding properties and methods on PFObject subclasses conveniently skips the Swift syntax in their sample code listing just the Objective-C syntax: https://parse.com/docs/ios_guide#subclasses-properties/iOS ``` // Armor.h @interface Armor : PFObject<PFSubclassing> + (NSString *)parseClassName; @property (retain) NSString *displayName; @end // Armor.m @dynamic displayName; ``` Has anyone figured out a work around for Swift's lack of dynamic synthesizers in order to implement properties and methods with PFSubclassing? I want to be able to do something like: ``` class Armor : PFObject, PFSubclassing { class func parseClassName() -> String! { return "Armor" } } var armor = Armor() armor.displayName = "Iron Clad" ```