NSObject-FromClassName:快速从其类名获取NSObject

时间:2024-05-18 01:53:23
【文件属性】:

文件名称:NSObject-FromClassName:快速从其类名获取NSObject

文件大小:1KB

文件格式:ZIP

更新时间:2024-05-18 01:53:23

Swift

NSObject-FromClassName 快速扩展,可从其类名快速获取NSObject extension NSObject { class func fromClassName ( className : String ) -> NSObject { let className = NSBundle. mainBundle (). infoDictionary ! [ " CFBundleName " ] as! String + " . " + className let aClass = NSClassFromString (className) as! UIViewController. Type return aClass. init () } } 我从字符串数组中得到一个viewCont


【文件预览】:
NSObject-FromClassName-master
----README.md(1015B)
----NSObject+FromClassName.swift(448B)

网友评论