Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- protocol UIViewNibHelper {
- }
- extension UIViewNibHelper {
- /// NibからViewを生成する
- ///
- /// - Returns: 自身のView
- static func generateViewFromNib() -> Self? {
- let className = String(describing: self)
- return Bundle.main.loadNibNamed(className, owner: nil, options: nil)?.first as? Self
- }
- }
- extension UIView: UIViewNibHelper {}
Add Comment
Please, Sign In to add comment