Skip to content

Instantly share code, notes, and snippets.

@orakaro
Created January 4, 2019 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orakaro/2e8968d48ffab5071ca21da4b87398c4 to your computer and use it in GitHub Desktop.
Save orakaro/2e8968d48ffab5071ca21da4b87398c4 to your computer and use it in GitHub Desktop.
protocol XibViewController {
static var className: String { get }
static func make() -> Self
}
extension XibViewController where Self: UIViewController {
static var className: String {
return String(describing: self).components(separatedBy: ".").last!
}
static func make() -> Self {
return self.init(nibName: Self.className, bundle: nil)
}
}
extension UIViewController: XibViewController {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment