Get NSClassFromString from Array of Strings - Swift
问题 I am trying to write a function that loads a particular view controller from my array of string>. However I'm struggling with this concept in swift - I achieved this in Objective - C. static NSString const *const viewControllerClassName[3] = {@"one", @"two", @"three"}; . // get the name of the class of the viewcontroller that will be shown on this page const NSString *className = viewControllerClassName[1]; Class class = NSClassFromString((NSString *)className); UIViewController *controller =