I have a dictionary of objects, and I would like to do this through a dataset and return an array of objects that conform to this protocol. I am having problems with the syntax for passing in the desired protocol:
func getObjectsThatConformTo<T>(conformance: T.Type) -> [AnyClass]{ var returnArray: [AnyClass] = [] for(myKey, myValue) in allCreatedObjects{ if let conformantObject = myValue as? conformance{ returnArray.append(conformantObject) } return returnArray }
The error I see is a "match", not a type
Thank you for your help and time.
ios iphone swift protocols
Cwineland
source share