UIViewController *viewController = [[NSClassFromString(viewControllerName) alloc] init];
如何将NSClassFromString
的此代码转换为swift
?
答案 0 :(得分:1)
你可以这样写:
if let viewController = NSClassFromString(viewControllerName) as? UIViewController.Type {
// Do something
}