Last active
June 23, 2023 09:38
-
-
Save juliancadi/370616e217ded71febbf5b96ecf788dc to your computer and use it in GitHub Desktop.
Nibless UIViewController in favor of initializer dependency injection.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
open class NiblessViewController: UIViewController { | |
public init() { | |
super.init(nibName: nil, bundle: nil) | |
} | |
@available(*, unavailable, | |
message: "Loading this view controller from a nib is unsupported in favor of initializer dependency injection." | |
) | |
public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { | |
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) | |
} | |
@available(*, unavailable, | |
message: "Loading this view controller from a nib is unsupported in favor of initializer dependency injection." | |
) | |
public required init?(coder aDecoder: NSCoder) { | |
fatalError("Loading this view controller from a nib is unsupported in favor of initializer dependency injection.") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment