> On Nov 12, 2016, at 22:47 , David Sweeris <daveswee...@mac.com> wrote:
> 
> 
>> On Nov 13, 2016, at 00:38, Rick Mann via swift-users <swift-users@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?

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
rm...@latencyzero.com


_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to