Im trying to pass AnyClass to generic function like this:
if let arrayObjectClass = NSClassFromString("arrayObjectTypeName") {
foo(type: arrayObjectClass)
}
where foo looks like this:
func foo<T>(type: T.Type) {
...
}
but it fails to compile with error:
Cannot convert value of type 'AnyClass' (aka 'AnyObject.Type') to expected argument type 'T.Type'