-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Implemented percentage values in YogaKit #390
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
Conversation
|
Very cool! I'll be able to merge this in on Monday, can you rebase and update the new |
| #import <yoga/YGEnums.h> | ||
| #import <yoga/Yoga.h> | ||
|
|
||
| extern YGValue YGPoint(CGFloat value) NS_SWIFT_UNAVAILABLE("Use the swift Int and FloatingPoint extensions instead"); |
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.
nit, lets wrap these:
EXTERN_C_BEGIN
(functions)
EXTERN_C_END
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.
Will do it!
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.
Still need to do this.
|
We also need to update this gist so the github docs have been updated. |
|
|
@dshahidehpour Any ideas for improving the problem with Swift variables? |
|
@hartbit Not yet, but I haven't taken much a look yet. |
|
@hartbit, since Swift doesn't allow implicit casting, I think we might be out of luck... In the meantime, the Pixel rename has landed (as well as a bunch of changes to YogaKit), so, if you want to rebase, we can move forward this. I would also really appreciate it if you could add an example to the new Sample App for percentage widths. |
|
@hartbit Do you have an update on this? I would love to get this into the next release. |
|
@emilsjolander Hello! Sorry, I've been very busy lately. I'll rebase this ASAP. |
|
No worries! Thanks 👍 |
dea31f2 to
9b072e1
Compare
|
@emilsjolander finally rebased. Sorry for the delay! |
|
I'm on vacation this week. @dshahidehpour could you have a look? |
d16r
left a comment
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.
Okie, just need to fixup the extern function, and we should be able to merge.
| #import <yoga/YGEnums.h> | ||
| #import <yoga/Yoga.h> | ||
|
|
||
| extern YGValue YGPoint(CGFloat value) NS_SWIFT_UNAVAILABLE("Use the swift Int and FloatingPoint extensions instead"); |
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.
Still need to do this.
| - (void)set##capitalized_name:(CGFloat)lowercased_name \ | ||
| { \ | ||
| YGNodeStyleSet##capitalized_name(self.node, lowercased_name); \ | ||
| #define YG_VALUE_PROPERTY(lowercased_name, capitalized_name) \ |
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.
Once this lands, I really want to remove these defines. It might be a bit of extra code, but I'd rather try and use function pointers instead of this.
|
@emilsjolander has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
@hartbit Sorry this took ages to merge. My bad. Really appreciate this contribution and we are all excited to start using it 👍 👍 👍 |
We still need to wait for the
YGUnitPointPR to be merged :) But please let me know what you think. One caveat: because of a limitation of Swift, a literal value can be automatically understood as a point-basedYGValue, but variables have to be explicitly cast. I haven't found a way around it yet: