贡献者:赵大财
博客:https://my.oschina.net/zhaodacaiGitHub:https://github.com/dacaizhao
邮箱: dacai_zhao@163.com QQ:327532817
=============================
//获取工程的名字 func getBundleName() -> String{ var bundlePath = Bundle.main.bundlePath bundlePath = bundlePath.components(separatedBy: "/").last! bundlePath = bundlePath.components(separatedBy: ".").first! return bundlePath } //通过类名返回一个AnyClass func getClassWitnClassNmae(_ name:String) ->AnyClass?{ let type = getBundleName() + "." + name return NSClassFromString(type) }