> On Nov 12, 2016, at 22:47 , David Sweeris <[email protected]> wrote: > > >> On Nov 13, 2016, at 00:38, Rick Mann via swift-users <[email protected]> >> 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?
Yeah, it just happens in a few places, would be nice to write the code once and then just ensure classes exist. I know I could do it subclassing NSObject, but Swift really ought to have proper reflection. -- Rick Mann [email protected] _______________________________________________ swift-users mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-users
