A project I am working on correlates our Storyboard file's names with the UIViewController subclass that is it's initial view controller. The result is a Storyboards.* struct that conflicts in naming with the view controller type itself:
...
struct ExampleViewController: Storyboard {
static let identifier = "ExampleViewController"
static var storyboard: UIStoryboard {
return UIStoryboard(name: self.identifier, bundle: nil)
}
static func instantiateExampleViewController() -> ExampleViewController {
return self.storyboard.instantiateExampleViewController() as! ExampleViewController
}
static func instantiateViewController(withIdentifier identifier: String) -> UIViewController {
return self.storyboard.instantiateViewController(withIdentifier: identifier)
}
static func instantiateViewController<T: UIViewController>(ofType type: T.Type) -> T? where T: IdentifiableProtocol {
return self.storyboard.instantiateViewController(ofType: type)
}
}
...
I appreciate the brevity of the struct's name and appending something like "File" clutters that. On the other hand it is more explicit: these are mappings to files as much as we'd love to abstract them away.