A picture is worth a thousand words, how to rewrite this code from Objective-C to Swift?
- (id) instanceOfClass: (Class) class withInitializer: (SEL) initializer
This cannot be done purely in Swift. You can only do this by creating the "class instance by name creator" in Objective C and calling this code from Swift.
For more information you can read this article. http://ijoshsmith.com/2014/06/05/instantiating-classes-by-name-in-swift/
And check out this github repo https://github.com/ijoshsmith/swift-factory