I have a protocol:
protocol InnerObject
{
init(record : NSManagedObject)
init(pfObject : PFObject)
func saveToRecord(aRecord: NSManagedObject)
func toPFObject() -> PFObject
}
and I have an extension for an array:
extension Array where Element : InnerObject
{
func pfObjects() -> [PFObject]
{
var pfObjects : [PFObject] = []
for innerObject in self
{
let pfObject : PFObject = innerObject.toPFObject()
pfObjects.append(pfObject)
}
return pfObjects
}
}
and I'm trying to use it:
func saveObjects(aObjects : [InnerObject], withCompletion aCompletion : () -> (Bool, NSError))
{
let array : [PFObject] = aObjects.pfObjects() // the error is here
}
but it produces an error:
Type 'InnerObject' does not conform to protocol 'InnerObject'
How do I resolve it?