-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Autoboxing for scalar/struct attribute values #62
Conversation
@nickynick looks cool 👍 My only reservation is that this means that |
However to be on the safe side maybe we can default to using Unless the developer opts in to the unprefixed version by adding a define to their prefix.pch We would need to leave in the existing methods What are your thoughts? |
@cloudkite Yup, that's what I'm thinking about right now too. One possibility would be to do something like this (similar to
This would also require to provide actual implementation for these methods for non-define fallback. Perhaps there is another solution, I'm looking for it. |
I went with Added macro for I also decided to take the liberty and did a little cleanup by means of moving implementations of semantically identical abstract methods to |
@cloudkite I'm pretty much done :) Please check if there's anything else to fix for me when you have some spare time. |
@nickynick nice work! Sorry I'm a bit swamped at work at the moment, but will try my best to review it as soon as possible :) |
@cloudkite No probs :) |
@@ -171,6 +171,35 @@ | |||
|
|||
@end | |||
|
|||
|
|||
@interface MASConstraint (Private) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe move this into its own file? And then import it in the necessary .m files then it will be truly private as it wont be exposed by masonry.h
Also once its private we wont have to prefix with _
Works very nicely 👍 Just one small comment. Once it's merged I will try finish off #56 asap so we can push out a new cocoapods version |
They are not really private because this is what macros actually expand to, therefore they should be visible in public scope. It's just that you are really not supposed to be calling them manually. Maybe it would make sense to change category name from |
yeah sounds good. Should we drop the underscore prefix? Given apple states they reserve it for their own use? |
I'd leave underscores because otherwise these methods will pop out in autocompletion which I would not like because they are really not supposed to be used directly :) Regarding Apple, well, we are subclassing So, I'd make a private header and move there |
I don't think NSObject subclasses are exempt from this convention. NSObject is likely to have a whole bunch of private methods that are prefixed. Its most likely a non-issue given that it is unlikely that NSObject would have methods with the same name. However just thinking its better to be on the safe side, won't they appear in autocomplete as |
I guess just trying to guard against possibility that apple becomes stricter with this convention in future and scans binaries for any underscore prefixed methods |
Sure they will, but only if you start typing with underscore :) Anyway, let's just unprefix |
looks great! Thanks again for the contribution 👍 |
Autoboxing for scalar/struct attribute values
Autoboxing for scalar/struct attribute values
Implemented my idea from #61. Allows you to write code like this (without using number literals and other ugly stuff):
Old code still works fine :)
Things I'm gonna do before this is ready for merging:
offset
? This would effectively ditchcenterOffset
andpointOffset
.