Guest User

Untitled

a guest
Jan 20th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import UIKit
  2.  
  3. protocol NibInitiable {
  4. static func loadFromNib() -> UIViewController?
  5. }
  6.  
  7. class C2MViewController: UIViewController, NibInitiable {
  8. static func loadFromNib() -> UIViewController? {
  9. return C2MViewController(nibName: String(describing: self), bundle: Bundle.main)
  10. }
  11. }
  12.  
  13. let ourVC = C2MViewController.loadFromNib()
  14. // ourVC is UIViewController?, there is a better way.
Add Comment
Please, Sign In to add comment