2019独角兽企业重金招聘Python工程师标准>>>
贡献者:赵大财
博客:https://my.oschina.net/zhaodacai GitHub:https://github.com/dacaizhao
邮箱: [email protected] 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)
}