-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Prefer CGFloat.pi
to CGFloat(M_PI)
#1198
Comments
Makes sense for me! |
Hmmm... this may be better off in a separate rule. 🤔 The Also |
I think semantically it makes more sense to be the same rule, even if the implementation is a bit different. You can use |
It's worth noting that |
@marcelofabri Sounds good. I'll continue down my the path of my initial implementation. I should have a PR raised later today. |
This appears to have introduced a bug where autocorrect is converting |
@raid5 I couldn't reproduce it. Could you fill an issue with more details? |
@marcelofabri, no problem. #1238 |
Swift supports
CGFloat.pi
for a CGFloat version of π as opposed to a Double. It also appears thatM_PI
is being deprecated.It would be good in the obvious cases where the developer wants a CGFloat version of π to detect and autocorrect to use the new Swift-y constant, avoid the typecast, and make the code more readable.
This may make sense as an extension of
legacy_constant
?For reference:
The text was updated successfully, but these errors were encountered: