When I try to do the following (I tried to make sure the names make sense of what I wanna do):
/*
* Base
*/
protocol BaseDepartment: class {
func headCount()->Int
}
class Employee<DepInterface: BaseDepartment> {
weak var department: DepInterface?
}
/*
* Actual
*/
protocol DevDepartment: class, BaseDepartment {
func devLanguages() -> [String]
}
class Developer: Employee <DevDepartment> {
}I get the following error:
Playground execution failed: /var/folders/04/br_2sh2n5cb2f84b7bl8pc6h0000gp/T/./lldb/56957/playground208.swift:21:18: error: using 'DevDepartment' as a concrete type conforming to protocol 'BaseDepartment' is not supportedCould you please help me fix this? Basically, I need to be able to pass protocols as type parameters in a generic. It works well for classes, but not for protocols!
Thanks a lot