Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- protocol NibInitiable {
- static func loadFromNib() -> UIViewController?
- }
- class C2MViewController: UIViewController, NibInitiable {
- static func loadFromNib() -> UIViewController? {
- return C2MViewController(nibName: String(describing: self), bundle: Bundle.main)
- }
- }
- let ourVC = C2MViewController.loadFromNib()
- // ourVC is UIViewController?, there is a better way.
Add Comment
Please, Sign In to add comment