I've created a Custom class for both PFQuery and PFObject, where I just Inherit/extend with those classes to not having to worry about importing Parse everywhere I use a Query or an Object.
However, I've encountered a problem when trying to mix PFQuery and PFObject together with their custom class.
Heres my Custom Classes which should in theory now have the same properties and effects as PFObject and PFQuery, which they do in most cases.
class CustomQuery: PFQuery {
override init(className:String) {
super.init(className: className)
}
}
class CustomObject: PFQbject {
override init(className:String) {
super.init(className: className)
}
}
But I've encountered a problem when trying to use a "..InBackgroundWithBlock" function from the Query. Here's the code:
func GetAsyncObjects(query:CustomQuery, closure: (dataObjects:[CustomObject]) -> ()) {
query.findObjectsInBackgroundWithBlock {(returnedObjects:[CustomObject]!, error:NSError?) -> Void in
closure(dataObjects: returnedObjects!)
}
}
The error occures at the second line of the block above, at "returnedObjects:[CustomObject]!" with the following error:
Cannot convert value of type '([CustomObject]!, NSError?) -> Void' to expected argument type 'PFQueryArrayResultBlock?'
I literally can't find to see the solution for this. Obviously changing CustomObject there to PFObject would work, but that makes the whole point of my CustomObject and CustomQuery obsolete.
Thanks!