Guest User

Untitled

a guest
Aug 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import UIKit
  2.  
  3. protocol UIViewNibHelper {
  4. }
  5.  
  6. extension UIViewNibHelper {
  7.  
  8. /// NibからViewを生成する
  9. ///
  10. /// - Returns: 自身のView
  11. static func generateViewFromNib() -> Self? {
  12. let className = String(describing: self)
  13. return Bundle.main.loadNibNamed(className, owner: nil, options: nil)?.first as? Self
  14. }
  15. }
  16.  
  17. extension UIView: UIViewNibHelper {}
Add Comment
Please, Sign In to add comment