My code is very simple.
My protocol:
protocol BaseEntity { class func getInstance(sourceObject: [NSObject : AnyObject], context: AnyObject!) -> BaseEntity init() }
Then in another class I have this method:
private func convertJSONDictionaryIntoModel(jsonDictionary : [NSObject : AnyObject], mapClass: BaseEntity.Type) -> BaseEntity { let object = mapClass.getInstance(jsonDictionary, context: nil) return object }
I got a compiler error in the first line, which reads as "Access to protocol type members. BaseEntity.Type not implemented"
As far as I can tell, this is possible in Swift.
source share