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

Don't rename "id" and similar variables #158

Open
arlomedia opened this issue Feb 23, 2021 · 1 comment
Open

Don't rename "id" and similar variables #158

arlomedia opened this issue Feb 23, 2021 · 1 comment

Comments

@arlomedia
Copy link

arlomedia commented Feb 23, 2021

Even though it's also a type name and confuses the code coloring in Xcode, "id" is a valid variable name in Objective-C and I've used it quite a bit. This should be even less of a problem in Swift because it's not a type name, but Swiftify renames my "id" variables to "anId":

input: NSString *id = @"foo";
output: let anId = "foo"
expected: let id = "foo"
demo: http://swiftify.me/i8a32t

Similarly:

input: for (NSString *id in sortedEvents) {}
output: for anId in sortedEvents {}
expected: for id in sortedEvents {}

I noticed the same behavior with variables named "url" being changed to "anUrl." I think in both languages, "URL" is a type, but "url" is a valid variable name.

@alex-swiftify
Copy link
Member

@arlomedia This makes perfect sense, will be fixed for sure.

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

No branches or pull requests

2 participants