extension UIResponder {
static var identifier: String {
return String(describing: self)
}
}
protocol Instance {
associatedtype Instance
static var sbName: String {get}
static var instance: Instance {get}
}
extension Instance {
static var sbName: String {return "Main"}
static var instance: Instance {
let storyboard = UIStoryboard(name: sbName, bundle: nil)
let identifier = String(describing: Instance.self)
let viewController = storyboard.instantiateViewController(withIdentifier: identifier)
return viewController as! Instance
}
}