[swift-users] Reflection in Swift 3?
David Sweeris
davesweeris at mac.com
Sun Nov 13 00:47:30 CST 2016
> On Nov 13, 2016, at 00:38, Rick Mann via swift-users <swift-users at swift.org> wrote:
>
> So, it seems there's still no way to do something like instantiate a class given only its name (as a String)?
>
> In my situation, I have a number of subclasses (or protocol implementations), which parallel some other class hierarchy. I need to dynamically create one based on the name of another. I don't want the latter classes to "know" anything about the former.
Not that I know of... If this is all your code, can you fake it by switching over the type's name?
- Dave Sweeris
More information about the swift-users
mailing list