[swift-users] Instantiate Swift class from string

Matthew Davies matthew at daviesgeek.com
Wed Dec 9 23:42:57 CST 2015

I am using the Swift build tool & package manager. I'm trying to figure out
how to instantiate a class from a string. For instance, in PHP I can do:

$instance = new $className

I can (in the iOS & OS X runtimes) use "NSClassFromString", but this is
unavailable in the Swift build tool. How can I (or can I?) get the same

*Matthew Davies*
Junior Developer, GeoStrategies <http://geostrategies.com/>
Director of Photography, OffBlock Films <http://offblockfilms.com/>
209-225-3246 <209-225.3246> | 209-202-3284 | matthew at daviesgeek.com |
<http://facebook.com/daviesgeek>  <http://us.linkedin.com/in/daviesgeek>
<http://twitter.com/daviesgeek>  <http://daviesgeek.com/feed.xml>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151209/766cb18c/attachment.html>

More information about the swift-users mailing list