// // NibUtil.swift // HCQuanfangtong // // Created by Apple on 2021/12/29. // Copyright © 2021 Jyp. All rights reserved. // import UIKit extension UINib{ static func loadNib(_ type : T.Type) -> UINib{ return UINib.init(nibName: String(describing: type), bundle: nil) } static func view(withType type : T.Type) -> T?{ return loadNib(type).instantiate(withOwner: nil, options: nil).last as? T } } extension NSObject{ var className:String{ get{ let name = type(of: self).description() if name.contains("."){ return name.components(separatedBy: ".")[1] } return name } } }