Open yoiang opened 6 years ago
There is no compile issue?
because there is Storyboards.ExampleViewController
vs ExampleViewController
The only things we can do is apply naming rules according to some options, like adding a postfix (like Storyboard
) or remove some part like ViewController
What are you expected?
There is a compilation issue because of that conflict.
I would expect the resulting code to be an expected, consistent output, ie: not to do a different naming convention for some VCs because they conflict but not for others because they don't. Applying a naming rule or removing parts may decrease the likelihood of a conflict but it will still be a possibility.
Other possibility, with Swift we can specify the specific ExampleViewcontroller
we are referencing if we know the project's module name:
...
struct ExampleViewController: Storyboard {
...
static func instantiateExampleViewController() -> ExampleModule.ExampleViewController {
return self.storyboard.instantiateExampleViewController() as! ExampleModule.ExampleViewController
}
...
}
...
so if there is a compile issue, please provide the error text or a test project it will be easier to understand
ps: we have already discuss in an other issue about id naming. (no time to search now)
A project I am working on correlates our
Storyboard
file's names with theUIViewController
subclass that is it's initial view controller. The result is aStoryboards.*
struct
that conflicts in naming with the view controller type itself: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.