123456789101112131415161718192021222324252627282930313233 |
- //
- // NibUtil.swift
- // HCQuanfangtong
- //
- // Created by Apple on 2021/12/29.
- // Copyright © 2021 Jyp. All rights reserved.
- //
- import UIKit
- extension UINib{
- static func loadNib<T>(_ type : T.Type) -> UINib{
- return UINib.init(nibName: String(describing: type), bundle: nil)
- }
-
- static func view<T>(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
- }
- }
- }
|