Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn about duplicate identifiers #34

Closed
6 tasks done
mac-cain13 opened this issue Jul 17, 2015 · 9 comments
Closed
6 tasks done

Warn about duplicate identifiers #34

mac-cain13 opened this issue Jul 17, 2015 · 9 comments

Comments

@mac-cain13
Copy link
Owner

  • Images
  • Storyboards
  • Storyboard segues
  • Storyboard viewControllers
  • Nibs
  • Reusable cells
@mac-cain13
Copy link
Owner Author

For images this will be fixed with PR #44

@tomekc
Copy link

tomekc commented Aug 9, 2015

I think duplicate reusable cells warning may be valuable - as there is no real requirement for cells to be unique across project. I have couple of default "Cell" identifiers which result in uncompilable code.

I fixed it on private branch by de-duplication of reusable cells variables, which should(?) do no harm.

@mac-cain13
Copy link
Owner Author

@tomekc Thanks for replying!

Yes, true, it's valid and can be used. I would consider it a bad practice, it's better to explicitly and uniquely name your cells to make them easily reusable and prevent confusion. My opinion is that R.swift should warn you about it and just skip those cells in the struct. Of course it should never generate uncompilable code.

@mac-cain13
Copy link
Owner Author

Segues should be changed so they are an extension on the viewcontroller and not global things. This makes duplicates less likely and if in that situation there are duplicates they really are a problem so a warning is appropriate then.

This also would enable us to make typed segues in the end.

@mac-cain13
Copy link
Owner Author

Duplicate viewController identifiers give compile errors from Apple's storyboard compiler. So this is a lower priority thing. Won't fix it now, maybe sometime in the future.

It's not a problem that R.swift generated uncompilable code from such a storyboard since the storyboard itself also won't compile.

@tomekc
Copy link

tomekc commented Aug 25, 2015

True, but it is a good practice to have multiple storyboards in larger projects. R.swift bundles all identifiers from all storyboards. You do not really have to use globally unique cell or segue identifiers across all storyboards, do you?

@mac-cain13
Copy link
Owner Author

Issue #71 proposes to scope segues to their source ViewController, so that would fix that problem.

Cells in different storyboards don't really have to be unique that's correct, outside storyboards (in nib files) it is good practice to have unique identifiers. I think it's not very user friendly/handy to namespace the reuseIdentifiers.

What would be your ideal solution?

@AndrewSB
Copy link

AndrewSB commented Dec 2, 2015

I think if the reuseIdentifiers are in different storyboards you shouldn't flag a warning. That would be ideal.

I use the slightly juvenile reuseIdentifier lol for my UITableViews that only have one reuseIdentifier. Would it be possible to not flag a warning if the reuseIdentifiers are across separate storyboards?

@RishabhTayal
Copy link

I think the reuseIdentifiers should be unique only for a particular UIViewController. A storyboard can have multiple view controllers and different view controllers can have same reuseIdentifiers. That should work without giving any warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants