美文网首页
Swift String转Class

Swift String转Class

作者: 小明讲啥故事 | 来源:发表于2022-04-01 14:48 被阅读0次
    let nameSpage = Bundle.main.infoDictionary!["CFBundleExecutable"]
    let childVcClass = NSClassFromString((nameSpage as! String) + "." + clsName)
    
     if  let appName: String? = NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleName") as! String? {
            let classStringName = "_TtC\(appName!.characters.count)\(appName!)\(className.characters.count)\(className)"
            let  cls: AnyClass? = NSClassFromString(classStringName)
      } 
    

    相关文章

      网友评论

          本文标题:Swift String转Class

          本文链接:https://www.haomeiwen.com/subject/rqeajrtx.html