For the latest version of Parse 1.9.1 and Swift 2.1, then the following applies:
- No need to show that the class conforms to the protocol PFSubclassing, the following is enough
class Event : PFObject { // code }
- If you use pods then you dont need to include Parse, PFSubclassing everywhere
A example can look like the following:
class Event: PFObject {
// @NSManaged gives you autosuggest and type check
@NSManaged var var1: String?
@NSManaged var var2: String?
override class func initialize() {
struct Static {
static var onceToken : dispatch_once_t = 0;
}
dispatch_once(&Static.onceToken) {
self.registerSubclass()
}
}
}
I will try your class generator, feels like I can save a lot of time there. Have been researching the best way to map Swift objects to Parse. I built my structure from a UML Class Diagram and added the relations set in the Parse DB to the diagram. Not best practice though it gives me what I need.
Going to use your generator, and design it as 4 tier with 4th tier being Parse DB and tier 3-1 being MVC, with M generated with your code and the needed logic from the UML Class diagram.