Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 572 Bytes

README.md

File metadata and controls

14 lines (10 loc) · 572 Bytes

swift-factory

This simple repository shows how to instantiate classes by class name in Swift. It uses Objective-C interop to perform the actual object creation. A generic utility Swift class named ObjectFactory provides a convenience API.

This code was tested against the first beta of iOS 8. The sample project is an OS X command line for the sake of simplicity.

Refer to main.swift to see how to use ObjectFactory.

For more information about the project refer to this blog post: http://ijoshsmith.com/2014/06/05/instantiating-classes-by-name-in-swift/