Subclassing PFObject in Swift

前端 未结 5 2302
南方客
南方客 2020-12-05 14:49

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

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-05 15:52

    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.

提交回复
热议问题