Ok here's the problem:
say we have a parent class that holds an array of ChildClasses
class ParentClass {
var list: [ChildClass<UITableViewCell>] = []
func append<T>(cell: T) where T: UITableViewCell {
let child = ChildClass<T>()
list.append(child)
}
}
and the child class
class ChildClass<T> where T: UITableViewCell {
var obj: T!
}
both of the classes are generic and the Type(T) is alway of the type UITableViewCell
now if you try to build it you'll get this error:
Cannot convert value of type ChildClass< T > to expected argument type ChildClass< UITableViewCell >
but if the T is a subclass of UITableViewCell, shouldn't it be able to convert the T???
thanks in advance