I have a generic class of type T and I would like to get the name of the type that passed into the class when instantiated. Here is an example.
class MyClas
You can return any types' name by using string interpolation:
class MyClass { func genericName() -> String { return "\(T.self)" } }
You can try it in a playground and it works as expected:
var someClass = MyClass() someClass.genericName() // Returns "Swift.String"