Trying to derive a class type = JSONDecoder from a string

I get a compiler error at the live below. I have tried other combinations as well.
Code Block
let decoder = JSONDecoder()
if let className = transation.name,
let newClass = Bundle.main.classNamed(className) 
{
let object = try decoder.decode(type(of: newClass.self), from: decompressedData) <==== Type of expression is ambiguous without more context
}

Or
Code Block
let object = try decoder.decode(newClass.self, from: decompressedData) <==== Type of expression is ambiguous without more context

Is what I want to do possible?




Is what I want to do possible?

NO.
Decodable is based on the static type system. Swift compiler needs to know the type at compile-time.
Any attempt to use some dynamic type will fail.
Got it. And thanks for the clarification.
Trying to derive a class type = JSONDecoder from a string
 
 
Q